I am writing my first macro and have a question on how I can select a specific Row based on a value in a specific column. here is my code so far:
Sub Pipeline()
'Module 3
'Iterating through the Funding Date Column and looking for clients going live within 30 days
'Selecting the rows for each client in that target range
'TODO: Export information into an email template in Outlook
'TODO: Send email to distribution list
Dim fundingDate As range
Set fundingDate = range("M4:M500")
Dim todaysDate As Date
todaysDate = Date
For Each cell In fundingDate
If cell < todaysDate + 30 Then
'Need to select the entire row
Else
cell.Font.ColorIndex = 3
End If
Next
End Sub
replace
'Need to select the entire rowwithcell.entirerow.selectUPDATE
Here is a much more efficient way to get what you need without all the looping.
In your code Replace from
For Each cell ...toNextwith this:You may need to provide some error checking in case you don’t have clients going live within 30 days (
SpecialCellsmethod will fail on this) and also, if M4 is not your column header, you may want to adjust how the range picks up the visible cells.