|
请教增加日期的天数之后,比如100天,甚至有1000天,就会增加了大量的数据,这里的宏该怎么改?谢谢大家!
Sub 每天()
Dim r%, i%
Dim arr, brr
Dim d As Object
Set d = CreateObject("scripting.dictionary")
ts = Application.InputBox(prompt:="请输入相隔天数", Title:="操作提示", Default:=0, Type:=1)
With ActiveSheet
r = .Cells(.Rows.Count, 1).End(xlUp).Row
.Range("c3:v" & r).Interior.Color = 16772537
arr = .Range("c3:v" & r)
ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
For i = 1 To UBound(arr) - ts - 1
d.RemoveAll
For j = 1 To UBound(arr, 2)
d(arr(i + ts + 1, j)) = Empty
Next
n = 0
For j = 1 To UBound(arr, 2)
If d.exists(arr(i, j)) Then
.Cells(i + 2, j + 2).Interior.ColorIndex = 3
n = n + 1
brr(i, n) = j
End If
Next
Next
.Range("x3").Resize(UBound(brr), UBound(brr, 2)) = brr
End With
End Sub
99-20.zip
(34.06 KB, 下载次数: 5)
|
|