Error 1004 - Unable to get the VLookup Property of the WorksheetFunction Class

Ananthak275

Board Regular
Joined
Aug 22, 2020
Messages
128
Office Version
  1. 2013
Platform
  1. Windows
  2. MacOS
My code is erroring out. Can someone help me understand why?
VBA Code:
Sub Vlookup_Status()
Workbooks(destWB).Activate

rownum = 2
While Cells(rownum, Product_Column).Value <> ""
'This will autofill the columns
Worksheets(destWB_Sheet).Cells(rownum, Category_Column).Value = Application.WorksheetFunction.VLookup(Worksheets(destWB_Sheet).Cells(rownum, Product_Column).Value, _
ThisWorkbook.Sheets(1).Range("A:B"), 2, False)

Worksheets(destWB_Sheet).Cells(rownum, Domain_Column).Value = Application.WorksheetFunction.VLookup(Worksheets(destWB_Sheet).Cells(rownum, Product_Column).Value, _
ThisWorkbook.Sheets(1).Range("A:C"), 3, False)

rownum = rownum + 1

Wend

End Sub
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Either you have only given us part of your code or else you have a lot of undefined variables.
All of these are undefined in the code you have posted:
destWB
Product_Column
destWB_Sheet
Category_Column
Domain_Column
 
Upvote 0

Forum statistics

Threads
1,215,331
Messages
6,124,312
Members
449,152
Latest member
PressEscape

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top