VBA for reverse vlookup from closed workbook

makulig99

New Member
Joined
Mar 19, 2018
Messages
1
Hello

Sorry for my english. I need help regarding below issue. I need to use vlookup in a closed workbook searching for a value from right to the left. Macro is working from left to the right but I need to search values from right to the left. I have something like this:

Sub vlokup()


Dim wbA As Workbook
Dim sFilename As String
Dim Range1 As Range
Set wbA = ThisWorkbook
sFilename = "C:\Users\mm\Desktop\Projekt dla GB\Spotfire.xlsx"
With GetObject(sFilename)
Set Range1 = Intersect(.Sheets("data").Range("B:C"), .Sheets("data").UsedRange)
'Range("G3:G50").Value = Application.WorksheetFunction.VLookup(Range("F3:F50").Value, Range1, 2, False) - this works
Range("G3:G100").Value = Application.WorksheetFunction.VLookup(Range("F3:F100").Value, Application.WorksheetFunction.Choose(2, Range("$C2:$C1000"), Range("$B2:$B1000")), 2, False) - this not - just want to search by C and return B (reverse)
.Close
End With
End Sub

Any suggestions ;)?:)


 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
what difference does it make to search left-to-right vs backwards?
the code will find it.
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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