On Aug 13, 1:45*pm, JLGWhiz <JLGW...@discussions.microsoft.com> wrote:
> This is untested:
>
> Sub RetClient()
> * *Dim lr1 As Long, lr2 As Long
> * *Dim empNr As Range, c As Range *
> * *lr1 = Worksheets(1).Cells(Rows.Count, 2).End(xlUp).Row
> * *lr2 = Worksheets(2).Cells(Rows.Count, 5).End(xlUp).Row
> * *Set rng1 = Sheets(1).Range("B2:B" & lr1)
> * *Set rng2 = Sheets(2).Range("E2:E" & lr2)
> * *For Each empNr In rng2
> * * * Set c = rng1.Find(empNr, LookIn:=xlValues, _
> * * * *LookAt:=xlWhole, MatchCase:=False)
> * * * * If Not c Is Nothing Then
> * * * * * *empNr.Offset(0, -1) = c.Offset(0, -1).Value
> * * * * End If
> * *Next
> End Sub * *
>
>
>
> "ed.cabrera" wrote:
> > I might be pressing my luck here ....but *(I already got one really
> > good answer off here today ; )
>
> > Ok here's what I'm trying to figure out now:
>
> > Spreadsheet 1 contains the client's name in column A and their
> > employee number in column B
>
> > Spreadsheet 2 contains raw data that only lists the client's employee
> > number in column E.
>
> > Is there a simple (or macro) solution that can run in Spreadsheet 2
> > and compare what's in column E to what's in column B in Spreadsheet 1;
> > and then enter the client's name in column D of Spreadsheet 2?
>
> > Thanks for the help, everyone!- Hide quoted text -
>
> - Show quoted text -
This one worked!!
Thanks everyone for helping out! (Now if I can just figure out the
code so that I'll understand why it works LOL)
|