如何修改此VBA脚本以仅提取指定日期范围内的行?

时间:2017-01-05 15:18:26

标签: vba excel-vba excel

我有以下VBA脚本,我希望根据第3列进行过滤 - StartDate:

Sub RemDates()
Dim RowToTest As Long
Dim ws As Worksheet

For Each ws In ThisWorkbook.Sheets
  For RowToTest = ws.Cells(Rows.Count, 3).End(xlUp).Row To 1 Step -1  
    With ws.Cells(RowToTest, 3)
      If .Value > #12/24/2016# _
        And .Value < #12/29/2016# Then _
          ws.Rows(RowToTest).EntireRow.Delete
    End With
  Next RowToTest
Next
End Sub

但这不能正常工作。以下是我的电子表格(我想要过滤)的屏幕截图。

enter image description here

任何提示表示赞赏,谢谢

0 个答案:

没有答案