PDA

View Full Version : [SOLVED:] VBA: Index/Match



spencerp237
03-13-2017, 11:56 AM
Set lookupValue = Sheets("Results").Cells(i, 2)

myStringThree = WorksheetFunction.Index(Sheets("Export2").Range("K2:K20"), WorksheetFunction.Match(lookupValue, Sheets("Export2").Range("L2:L20")))



I am trying to use Index/Match in my VBA code. This code runs, but gives a blank output and I am just wondering if anybody can see anything wrong with it.

mdmackillop
03-13-2017, 12:32 PM
Possibly missing the final Match Type. Also, code will fail if match not found


With WorksheetFunction
mystringthree = .Index(Sheets("Export2").Range("K2:K20"), .Match(lookupValue, Sheets("Export2").Range("L2:L20"), 0))
End With