我正在编写我的第一个宏,并对如何根据特定列中的值选择特定行存在疑问。这里是我到目前为止的代码:Excel宏:根据列日期选择特定行
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
既然你说这是你的第一个宏,这里有一个提示:总是使用'Option Explicit'(把它作为你模块的第一行)。这将迫使你声明你的变量。 –