vlookup vba

harvey121

New Member
Joined
Nov 27, 2018
Messages
20
Hi All,

I'm trying to pass the value of lookCol in the lookup formula here but getting an object defined error here. Can someone please help me with this

Code:
lastCol = Cells(1, Columns.Count).End(xlToLeft).Column

lookCol=0-lastCol


Cells(i, curCol).Value = "=IFERROR(VLOOKUP('[OC-App_Weekly(Basesheet).xlsm]Sheet1'!R[0]C[COLOR=#ff0000][[SIZE=2][B]lookCol[/B][/SIZE][/COLOR]],[Sheet1.csv]Sheet1!R2C2:R4C3,2,0),""0"")"
 
Last edited:
Hi, you could try like this.

Rich (BB code):
Cells(i, curCol).FormulaR1C1 = "=IFERROR(VLOOKUP('[OC-App_Weekly(Basesheet).xlsm]Sheet1'!R[0]C[" & lookCol & "],[Sheet1.csv]Sheet1!R2C2:R4C3,2,0),""0"")"
 
Upvote 0

Forum statistics

Threads
1,226,906
Messages
6,193,592
Members
453,809
Latest member
KMorales

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