Of course I can
declare variable names and their type:
Dim c As Range, ws As Worksheet
Set variable for ws
Set ws = Sheets("Sheet1")
This creates the the loop which we are using For Each in a certain range. the ws.Range part is setting the range which we could do prior by declaring and setting another variable. N.B - We're using UsedRange to find the last row we want to use
For Each c In ws.Range(ws.Cells(1, 3), ws.Cells(ws.UsedRange.Rows.Count, 3))
To declare and set another variable for the range we would
Dim rng as range
Set rng = ws.Range(ws.Cells(1, 3), ws.Cells(ws.UsedRange.Rows.Count, 3))
This would then change the For Loop to
Next we're checking if the cell (c) is = to todays date and if it is we want to select it and exit this routine because we've found what we're looking for. If it's not equal to todays date it will move onto the next cell in the range
If c = Date Then
c.Select
Exit Sub
End If
Bookmarks