|
- Private Sub CommandButton1_Click()
- Dim i, r, V As Integer
-
- i = [a65536].End(xlUp).Row
- r = 2
- V = r
- Do
- r = r + 1
- If Month(Cells(r, 1)) > Month(Cells(r - 1, 1)) Then
- Rows(r).Insert
- Cells(r, 1) = "小计"
- Cells(r, 3).Formula = "=SUM(C" & V & ":C" & r - 1 & ")"
- Cells(r, 4).Formula = "=SUM(D" & V & ":D" & r - 1 & ")"
- V = r + 1
- r = r + 2
- End If
- Loop Until Cells(r, 1) = 0
- Range("a1").CurrentRegion.Value = Range("a1").CurrentRegion.Value
- End Sub
- Private Sub CommandButton2_Click()
- Dim r As Integer
- r = [a65536].End(xlUp).Row
- With Range("D2:D" & r)
- .Replace "0", ""
- .Copy
- End With
- Range("e2").PasteSpecial Paste:=xlPasteAll, Operation:=xlMultiply
- Selection.Replace "0", "1"
- End Sub
- Private Sub CommandButton3_Click()
- Dim d, arr
- Dim r As Integer
- If Application.CountIf(Range("A:A"), "小计") Then
- arr = Range("a1").CurrentRegion
- Set d = CreateObject("Scripting.Dictionary")
- For r = 1 To UBound(arr)
- If arr(r, 1) = "小计" Then
- d(arr(r, 1) & r) = r & ":" & r
- End If
- Next
- Range(Join(d.items, ",")).Delete
- Range("e2:e" & UBound(arr)).ClearContents
- End If
- End Sub
复制代码 这几天工作太忙,一直没时间上传作业,希望老师能批阅一下? |
评分
-
查看全部评分
|