|
没有容错代码,假设都是按日期格式填写的.
- Sub 按日期汇总()
- Dim ARR(1 To 9999, 1 To 19), d As Date
- Sheets("汇总").Range("a3").CurrentRegion.ClearContents
- d1 = InputBox("请输入开始日期,格式: 2020/8/1")
- d2 = InputBox("请输入结束日期,格式: 2020/8/2")
- d1 = CDate(d1): d2 = CDate(d2)
- For i = 2 To Sheets.Count
- With Sheets(i)
- R = .Cells(Rows.Count, 2).End(xlUp).Row
- For j = 1 To R
- If d1 <= .Cells(j, 2).Value And d2 >= .Cells(j, 2).Value And .Cells(j, 2).Value <> "" Then
- n = n + 1
- For k = 1 To 19
- ARR(n, k) = .Cells(j, k)
- Next
- End If
- Next
- End With
- Next
- Sheets("汇总").[A3].Resize(9999, 20) = ARR
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|