【发布时间】:2016-03-24 03:05:54
【问题描述】:
我使用一个大型跟踪器来存储网站的建成日期。我正在尝试查看一系列单元格并确定日期是否是今天的日期。在我的跟踪器中实施之前,我写了一个小 Excel 表以使其不那么复杂。
这就是我正在使用的。
问题是当有更多时,它只选择今天日期的一行。
这是 Excel 在按下按钮时所做的选择。
如何选择多行? (它们可能不相邻。将来可能是第 1 行、第 5 行和第 8 行)。
' Date Selection Macro
' Goal! - Bring automated cell selection based on date range
' TODO - Create macro to select rows that have a given date range
' TODO - Create a window that allows you to add the given date range
' rather than hard code
' TODO - Export selected rows to an email template in Outlook
Sub DateSelection()
Dim completionDate As Range
Set completionDate = Range("B2:B8")
Dim todaysDate As Date
todaysDate = Date
For Each cell In completionDate
If cell = todaysDate Then
cell.EntireRow.Select
Else
'cell.Font.ColorIndex = 3
End If
Next
End Sub
【问题讨论】: