Error With Vlookup Formula?

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,917
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Is anyone able to provide me a set of educated eyes to reveal the problem in the highlighted code below that is chirping an "Application-deined or object-defined error".

Rich (BB code):
            With ws_thold 'the list
                '.Cells(d_th, 28) = posnum
                .Cells(d_th, 29) = x
                .Cells(d_th, 30) = pnum
                .Cells(d_ht, 31) = "=VLookup(""" & pnum & """,'D:\WSOP 2020\[permit_data.xlsx]Permit_Data'!A:S,5,false)" 'function(5)
                .Cells(d_ht, 32) = "=VLookup(""" & pnum & """,'D:\WSOP 2020\[permit_data.xlsx]Permit_Data'!A:S,12,false)" 'base dist(12)
                .Cells(d_ht, 33) = "=VLookup(""" & pnum & """,'D:\WSOP 2020\[permit_data.xlsx]Permit_Data'!A:S,19,false)" 'pitch dist(19)
                .Cells(d_th, 26) = bkg_st
                .Cells(d_th, 27) = bkg_et
                d_th = d_th + 1
            End With

pnum = R2685 and is found in closed workbook permit_data.xlsx, worksheet Permit data, cell A10. The value in F10 is "Hockey"
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

offthelip

Well-known Member
Joined
Dec 23, 2017
Messages
1,845
Office Version
  1. 2010
Platform
  1. Windows
The easiest way of trying to find errors when you are writing equations to the worksheet is to remove the equals sign from the start of the string you are writing to the cell, this means it just writes a string not an equation. Then run the macro, then go to the cell and add the equals sign back in, excel will then tell you wherethe error is.
 

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
3,917
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Thank you offthelip for that suggestion. It helped me realize the issue wasn't in the formula, it was in the destination.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,685
Messages
5,654,745
Members
418,149
Latest member
amamiche67

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
Top