07/06/01 15:05:11
>>81 それを早く(ry そっちの方が簡単だから。
Private Sub Sample()
Dim targetCell As Range
Dim date1 As Date, date2 As Date, date3 As Date
Dim interval As Integer
Set targetCell = Range("B1") 'Range("B1")の所は最初の年月が入っているセル
Do Until targetCell.Cells(2, 1) = ""
date1 = CDate(targetCell)
date2 = CDate(targetCell.Cells(2, 1))
interval = DatePart("n", date2 - date1)
If interval = 0 Then
Rows(targetCell.Cells(2, 1).Row).Delete
ElseIf interval > 10 Then
Rows(targetCell.Cells(2, 1).Row).Insert
date3 = DateAdd("n", 10, date1)
targetCell.Cells(2, 1) = Format(date3, "yyyy/M/d hh:mm")
Set targetCell = targetCell.Cells(2, 1)
Else
Set targetCell = targetCell.Cells(2, 1)
End If
targetCell.Select
Loop
End Sub