Following code:
For i = startRow To startRow + (nRows - 1)
Set lookUp = Range(col & i)
Range("I" & i) = IIf(WorksheetFunction.lookUp(lookUp, Sheets("P&C curves").Columns("A")) = lookUp, 1, 0)
Range("J" & i) = IIf(WorksheetFunction.lookUp(lookUp, Sheets("G Curve").Columns("A")) = lookUp, 1, 0)
Next i
In the code, the first time I call WorksheetFunction.lookUp everything works fine, namely it fills the column with 1 where it find something, else it puts a zero, but the second line does not work. I receive the error:
Unable to get lookup property of the worksheetfunction class.
Why does this happen? If I try to use the same logic directly in the excel sheet it works?
Would really appreciate any help…thanks a lot
Is this what you are trying?