I am trying to write some code that will search a workbook for a value given a string. Naturally I am using "Cells.Find(What:=.....". However I need my search string to have a number that is incremented on each loop and hence I wanted to put my search string into a variable.
Unfortunately if I specify the variable after the 'what:' it throws up an error. How can i get around this?
----------------------------------------------------------------
Sub Dates()
Dim Grand As String
For N = 1 To 47
Grand = "Grand Total" & N
Cells.Find(What:=Grand, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
ActiveCell = Format(WeekStartDate, "D-MMM")
Next N
End Sub
Bookmarks