|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Sub a()
Dim arr, i%, S, M%, T
arr = [a1].CurrentRegion
For i = 4 To UBound(arr)
If arr(i, 1) <> "本页小计" Then
S = "G" & i
Else
M = M + 1
If M = 1 Then
Cells(i, "G") = "=SUM(G4:" & S & ")"
Cells(i, "G").Resize(1, 11) = "=SUM(G4:" & S & ")"
Cells(i, "L").Resize(1, 5) = ""
T = "G" & i + 1
Else
Cells(i, "G") = "=SUM(" & T & ":G" & i - 1 & ")"
Cells(i, "G").Resize(1, 11) = "=SUM(" & T & ":G" & i - 1 & ")"
Cells(i, "L").Resize(1, 5) = ""
T = "G" & i + 1
End If
End If
Next
End Sub
|
评分
-
1
查看全部评分
-
|