Run Time Error 1004

rabso

New Member
Joined
Oct 21, 2010
Messages
36
Good morning I am trying to run this code, and it errors with the message
Run Time Error 1004. Can somebody please help me identify why?

Thank you Richard Baker

Code:
Sub Lookup()
Sheets("Summary").Select
Dim CurRow As Integer
CurRow = 1
For Each Y In Range("A" & CurRow, Range("A" & CurRow).End(xlDown))
If Y = "" Then Exit For
Y.Offset(0, 1).Formula = "=VLOOKUP(A " & CurRow & ", Data!$A:$H , 2, FALSE)"
CurRow = CurRow + 1
Next
'Reset Header
Range("B1").Value = "FIN WOID"
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
I don't really understand what you are trying to do with your Y and CurRow, but I think you meant this:

Code:
Sub Lookup()

    Sheets("Summary").Range("B2:B" & Sheets("Summary").Range("A2").End(xlDown).Row).Formula = "=VLOOKUP(RC[-1],Data!C[-1]:C[6],2,FALSE)"
    
End Sub

If not, please explain what Y and CurRow are about and at least on what line you get the error. Also, a space after the A in VLOOKUP(A does not seem an appropriate action.

Wigi
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

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