|
楼主 |
发表于 2010-10-10 21:07
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
回复 6楼 wj2368 的帖子
那天的代码我增加了一个计总数的代码,可不知道为什么执行起来会不停的跳动
期待你的解答,在此先谢了
Private Sub CommandButton1_Click()
Dim i1&, iO&, i&, sm#, aw#, arr1(), arr2(), arr3(), arr4()
arr1 = [B2].Resize([B65536].End(3).Row - 1, 4).Value
arr2 = [I2].Resize([I65536].End(3).Row - 1, 1).Value
arr3 = [m2:m21].Value
arr4 = [o2:o21].Value
For i1 = 1 To 9
For iO = 1 To UBound(arr3)
sm = 0
aw = 0
For i = 1 To UBound(arr1)
If arr1(i, 1) >= arr3(iO, 1) And arr1(i, 1) <= arr4(iO, 1) Then
aw = aw + arr2(i, 1)
End If
If arr1(i, 1) >= arr3(iO, 1) And arr1(i, 1) <= arr4(iO, 1) And arr1(i, 4) = Cells(1, 16 + i1) Then
sm = sm + arr2(i, 1)
End If
If sm <> 0 Then
Cells(iO + 1, 16 + i1).Value = sm
End If
If aw <> 0 Then
Cells(iO + 1, 16).Value = aw
End If
Next
Next
Next
End Sub |
|