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 ?
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 ?