PDA

View Full Version : [SOLVED] Quick VBA find question



plasteredric
03-30-2018, 12:56 PM
I have the below code, in the highlighted part im trying to search the entire row 'SourceHeaderDataRow' to find the cell that contains the text "ages"
however i keep getting an error.
Any ideas how i can fix this?
thanks


With ActiveSheet ' do everything on the active sheet from here on
Set DailyListStartFound = .Range("B:B").Find("Date", lookat:=xlWhole)


If DailyListStartFound Is Nothing Then
MsgBox "Daily Table Start Point Not Found", 0, "Check Error"
Exit Sub
End If

SourceFirstDataRow = DailyListStartFound.Row + 1
SourceHeaderDataRow = DailyListStartFound.Row

Set DailyListEndFound = .Range(SourceHeaderDataRow).Find("Ages", lookat:=xlWhole)

If DailyListEndFound Is Nothing Then
MsgBox "Daily Table End Point Not Found", 0, "Check Error"
Exit Sub
End If

p45cal
03-30-2018, 01:32 PM
change .Range to .Rows

plasteredric
03-30-2018, 02:29 PM
Thanks, worked a treat.
Such a simple answer, had me puzzled for a while.


change .Range to .Rows