Referencing Dim in VLOOKUP

Status
Not open for further replies.

crobinson661

New Member
Joined
Nov 15, 2019
Messages
11
Hate to bump, but I'm stuck.....
I posted Friday, but with 56 views, I'm the only post without a reply through Sunday, so I'll try to parse my inquiry.
VLOOKUP Macro Workbook Reference Variable

VBA Code:
 Range("J2").FormulaR1C1 = _
        "=IFNA(VLOOKUP(RC[-5],[" & wkb3 & "]!C5:C9,5,0),"""")"
    Range("J2").Select
    Selection.AutoFill Destination:=Range("J2:J80")
    Range("J2:J80").Select

This IFNA(VLOOKUP attempts to reference another workbook opened earlier in the Macro. I think my syntax is wrong, I've tried several variations and cannot figure out how it's wrong.

Most recently, I am getting "Run Time error 438: Object doesn't support this property or method"

Here's the code that opens the file:

VBA Code:
FileDate = Format(Date - 1, "DD-MMM-YYYY")
    FilePath = "V:\ParentDirectory\Folder1\Folder2\Folder3\Folder4 " & FileDate & ".csv"
    
    Dim wkb As Workbook
    Set wkb = ActiveWorkbook
    
    Dim wkb2 As Workbook
    Set wkb2 = Workbooks.Open("V:\ParentDirectory\Folder1\Folder2\ProductPriceFile.xlsx")
    
    Dim wkb3 As Workbook
    Set wkb3 = Workbooks.Open(FilePath)

Thanks for any suggestions
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Duplicate VLOOKUP Macro Workbook Reference Variable

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
Sorry for that...

I will gladly delete either post; if you could advise me as to where to delete?

Also, as an "MVP" do you happen to have any advice for the original question?

Thanks!

Duplicate VLOOKUP Macro Workbook Reference Variable

Please do not post the same question multiple times. All clarifications, follow-ups, and bumps should be posted back to the original thread. Per forum rules, posts of a duplicate nature will be locked or deleted (rule 12 here: Forum Rules).
 
Upvote 0
You don't need to delete anything, I forgot to lock this thread.
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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