keaveneydan
Board Regular
- Joined
- Apr 29, 2014
- Messages
- 144
Why won't this work? I would like to find in Column A the date contained in a certain cell.
If I set the range to be activeSheet and all Cells I get a random row returned....row 649
Thanks for any help
If I set the range to be activeSheet and all Cells I get a random row returned....row 649
Thanks for any help
Code:
Sub LastUsedRow_Find()
'FIND method to determine Last Row with Data, in a worksheet
Sheets("HSBC Fees update daily").Select
ValuationDate = Sheets("Net Assets").Range("C3").Value
Dim lastRow As Long
Dim rng As Range
Set rng = ActiveSheet.Columns(1)
lastRow = rng.Find(What:=ValuationDate, After:=rng.Cells(1), Lookat:=xlPart, LookIn:=xlFormulas, SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Row
MsgBox lastRow
End Sub