|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码如下。。。
Sub test11()
r = Cells(Rows.Count, 1).End(3).Row
For i = 23 To r
Sum = 0
Set Rng = [a2:a19].Find(Cells(i, 1).Value)
If Not Rng Is Nothing Then
FirstAddress = Rng.Address
Do
If Rng.MergeCells Then
Sum = Sum + Application.Sum(Rng.MergeArea.Offset(, 2).Resize(, 43))
Set Rng = [a2:a19].FindNext(Rng)
Else
Sum = Sum + Application.Sum(Rng.Offset(, 2).Resize(, 43))
End If
Loop While Not Rng Is Nothing And Rng.Address <> FirstAddress
End If
Cells(i, 3) = Sum
Next
Beep
End Sub
|
评分
-
2
查看全部评分
-
|