bobkap
Active Member
- Joined
- Nov 22, 2009
- Messages
- 313
- Office Version
- 365
- Platform
- Windows
- Mobile
- Web
I need to use a vlookup in my macro. I do NOT want to activate the worksheet as shown here in my code below. This line works, but darned if I can figure out the way to write the code that will work without first activating that worksheet.
Sheets("Promo").Activate
Custname = Application.WorksheetFunction.VLookup(procode, Range(Cells(1, 1), Cells(62, 2)), 2, False)
I've tried this line below but I got an error:
Custname = Application.WorksheetFunction.VLookup(procode, Sheets("Promo").Range(Cells(1, 1), Cells(62, 2)), 2, False)
Any help would be greatly appreciated.
Sheets("Promo").Activate
Custname = Application.WorksheetFunction.VLookup(procode, Range(Cells(1, 1), Cells(62, 2)), 2, False)
I've tried this line below but I got an error:
Custname = Application.WorksheetFunction.VLookup(procode, Sheets("Promo").Range(Cells(1, 1), Cells(62, 2)), 2, False)
Any help would be greatly appreciated.