我正在編寫我的第一個宏,並對如何根據特定列中的值選擇特定行存在疑問。這裏是我到目前爲止的代碼: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'(把它作爲你模塊的第一行)。這將迫使你聲明你的變量。 –