View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
L. Howard L. Howard is offline
external usenet poster
 
Posts: 852
Default i = row number of last occurance of duplicate string Column A


In the code, trying to assign the row number this formula returns to i.
=LOOKUP(2,1/(A1:A20="abc"),ROW(A1:A20)) = 15 (on the sheet Array Enter)

Errors out with "OneRng" in this line highlighted in blue (OneRng = "abc")
Code compiles, but with "expanded" spaces?? Then errors when run.

Sub SomeRangeA()
Dim OneRng As Range
Dim i As Long, ii As Long

Set OneRng = Range("A1:A" & Cells(Rows.Count, "A").End(xlUp).Row)
i = Application.WorksheetFunction.Lookup(2, 1 / (OneRng = "abc"), Row(OneRng))

End Sub

Thanks,
Howard