|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
更新,请参考
Sub calbank()
Dim i&, arr, x&
x = Sheets("sheet1").Range("d1048576").End(xlUp).Row
arr = Sheets("sheet1").Range("a1:H" & x)
For i = 2 To UBound(arr)
If Len(arr(i, 4)) = 0 Then Exit Sub
If Day(Date) <= arr(i, 4) Then x = 1
arr(i, 7) = DateSerial(2018, Month(Date) - x, arr(i, 4))
If Len(arr(i, 5)) > 0 Then
arr(i, 8) = DateSerial(2018, Month(Date), arr(i, 5))
Else
arr(i, 8) = DateValue(arr(i, 7)) + arr(i, 6)
End If
Next
Sheets("sheet1").Range("a1").Resize(UBound(arr), 8) = arr
End Sub
|
|