Runtime Error 1004 - Using VLOOKUP in VBA (COMPLETED)

ReggaeYT

New Member
Joined
Jul 24, 2014
Messages
16
Running a very basic test code to try out on a large amount of data, but having trouble, getting the "1004" error.

Sub HugeSort()
Dim c As Integer


'LOOPS THROUGH ALL ROWS
For c = 2 To 10

If IsEmpty(ActiveSheet.Cells(c, 1)) = False Then
ActiveSheet.Cells(c, 2) = Application.WorksheetFunction.VLookup(ActiveSheet.Cells(c, 1), Sheets("HALB").Range("A:B"), 2, 0)
End If
Next c


End Sub


Brief explanation: I've created a helper column (column 1) in 2 spreadsheets, and am now trying to VLOOKUP to transfer the data over from 1 to the other. Ran through 10000 lines and had no "1004" error in generating those helper numbers, but as soon as the VLOOKUP component was added, I can't get past this error. Thanks in advance for any help!
 
Last edited:

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Re: Runtime Error 1004 - Using VLOOKUP in VBA

One other note: sometimes the error is "Unable to get the VLookup property of the WorksheetFunction class"
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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