I am trying to get the multiple results form a Range and cannot use vlookup so using INDEX Function.
My formula "=INDEX(Sheet1!$A:$I,SMALL(IF(Sheet1!$A:$A=$A$2,ROW(Sheet1!$A:$A)),ROW(2:2)),7)"
worked perfectly but not working in VBA code. I am getting "Compile error: Expected : list separator or )" and when i debug cursor goes to the last part of the code where i have ROW(2:2).
Please assist. In code i am trying to insert the value which i will get from index function into Sheet2-D6 cell.
Here is my code.
Sheets("Sheet2").Range("D6").Value = Application.WorksheetFunction.INDEX(Sheets("Sheet1").Range("$A:$I"),Application.WorksheetFunction.SMALL(Application.WorksheetFunction.IF(Sheets("Sheet1").Range("$A:$A")= Sheets("Sheet2").Range("A2").Value, Application.WorksheetFunction.ROW(Sheets("Sheet1").Range("$A:$A"))),Application.WorksheetFunction.ROW(2:2)),7)
My formula "=INDEX(Sheet1!$A:$I,SMALL(IF(Sheet1!$A:$A=$A$2,ROW(Sheet1!$A:$A)),ROW(2:2)),7)"
worked perfectly but not working in VBA code. I am getting "Compile error: Expected : list separator or )" and when i debug cursor goes to the last part of the code where i have ROW(2:2).
Please assist. In code i am trying to insert the value which i will get from index function into Sheet2-D6 cell.
Here is my code.
Sheets("Sheet2").Range("D6").Value = Application.WorksheetFunction.INDEX(Sheets("Sheet1").Range("$A:$I"),Application.WorksheetFunction.SMALL(Application.WorksheetFunction.IF(Sheets("Sheet1").Range("$A:$A")= Sheets("Sheet2").Range("A2").Value, Application.WorksheetFunction.ROW(Sheets("Sheet1").Range("$A:$A"))),Application.WorksheetFunction.ROW(2:2)),7)