我正在制定一些付款计划。一行通常包含2到4个不同的日期以及客户信息。我想将包含今天日期的任何行从Sheet1复制到Sheet2。
感谢您的帮助,如果您需要其他信息,请与我们联系。
编辑:以下是一些无效的内容:
使用Sheet2的高级过滤器
List Range: Sheet1!$1:$1048576
Criteria Range: =today()
Copy To: $a$1
也
List Range: Sheet1!$1:$1048576
Criteria Range: =a1 //with a1 containing the formula =today()
Copy To: $b$1
答案 0 :(得分:2)
以下情况应该有效。
Sub copyIfTodaysDate()
Dim todaysDate As Date
Dim rngData As Range
Dim rngRow As Range
Dim rngCell As Range
Dim counter As Integer
todaysDate = Date
counter = 1
Set rngData = Worksheets("Table1").UsedRange
For Each rngRow In rngData.Rows
For Each rngCell In rngRow.Cells
If rngCell.Value = todaysDate Then
rngRow.Copy Worksheets("Table2").Rows(counter).Columns(1)
counter = counter + 1
Exit For
End If
Next
Next
End Sub