|
代码如下:
Sub calbank()
Dim i%, arr
arr = Sheets("sheet1").Range("a1").CurrentRegion
For i = 2 To UBound(arr)
If arr(i, 1) <> "" And arr(i, 2) <> "" Then
If Day(Date) < arr(i, 1) Then
arr(i, 3) = Month(Date) - 1 & "ヤツ" & arr(i, 1) & "ネユ"
arr(i, 4) = DateValue(arr(i, 3)) + arr(i, 2)
Else
arr(i, 3) = Month(Date) & "ヤツ" & arr(i, 1) & "ネユ"
arr(i, 4) = DateValue(arr(i, 3)) + arr(i, 2)
End If
If arr(i, 4) < Date Then
arr(i, 5) = "--"
arr(i, 6) = "--"
ElseIf arr(i, 4) = Date Then
arr(i, 5) = "ス・ケ"
arr(i, 6) = arr(i, 4) - Date
ElseIf arr(i, 4) > Date Then
arr(i, 5) = arr(i, 4) - Date & "フ・
arr(i, 6) = arr(i, 4) - Date
End If
End If
Next
Sheets("sheet1").Range("a1").Resize(UBound(arr), 6) = arr
End Sub
|
|