Prevost
Board Regular
- Joined
- Jan 23, 2014
- Messages
- 198
Hi There. I am using the .find function to find a value in a range (single column) and return the row number where that value first occurs. When my range is Cells(2,1) to Cells(40,1) and my value that I am trying to find is in Cell(2,1) (the value is actually in first 10 cells) the message box returns 3, not 2. Is this something inherent to Excel's find function, that it will not find the a matching value if it is in the first cell of a range or (more likely) what am i doing wrong? Thanks!
Code:
Sub testyme()
Dim findtest As Range
Set findtest = Range(Cells(2, 1), Cells(40, 1)).Find(what:="8E00002", lookat:=xlWhole)
MsgBox (findtest.Row)
End Sub