kelseye2eye
New Member
- Joined
- Apr 17, 2013
- Messages
- 6
Hi,
I'm new to vba and I need a to run a vlookup on one worksheet based upon the data in another worksheet. The amount of data is variable in both worksheets.
Issues I am facing:
I'm new to vba and I need a to run a vlookup on one worksheet based upon the data in another worksheet. The amount of data is variable in both worksheets.
Issues I am facing:
- I want my Vlookup to populate from B2:Lastcellrownumber but I can't get it to work.
- for the Vlookup, what is the best way to look up the range on the other worksheet when the data range is variable?
Code:
Dim WS As WorksheetDim Lastcell As Range
Dim LastcellRownumber As Long
Set WS = Worksheets("People")
With WS
Set Lastcell = .Cells(.Rows.Count, "A").End(xlUp)
LastcellRownumber = Lastcell.Row
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'Users'![COLOR=#ff0000]here is where I need to be able to have a variable range based upon the amount of data in the 'Users' worksheet[/COLOR],2,0)"
End With
/CODE]
Thanks for any help!