Private Sub CommandButton1_Click()
Dim a As Integer, c As Integer, i As Integer
a = [a65536].End(3).Row + 1
c = 2: i = 2
Do Until i >= a
If Month(Cells(i, 1)) <> Month(Cells(i + 1, 1)) Then
Cells(i + 1, 1).EntireRow.Insert
a = a + 1: i = i + 1
Cells(i, 1) = "小计"
Cells(i, 3) = Application.Sum(Range("C" & c, "C" & i - 1))
Cells(i, 4) = Application.Sum(Range("D" & c, "D" & i - 1))
c = i + 1
End If
i = i + 1
Loop
End Sub
Private Sub CommandButton2_Click()
Range("c1:c" & [a65536].End(3).Row).SpecialCells(xlCellTypeBlanks).Offset(0, 2) = 1
End Sub
第11课作业题.rar
(26.96 KB, 下载次数: 3)
|