|
楼主 |
发表于 2014-4-27 09:57
|
显示全部楼层
LJH3011308 发表于 2014-4-26 15:46
博士,你好,求您帮我看一下这个表的VB编码要怎样做? - Sub lqxs()
- Dim Arr, i&, r%, Arr1(), ks, js
- Sheet4.Activate
- Arr = [a1].CurrentRegion
- For i = 2 To UBound(Arr)
- If Arr(i, 3) = "合计行" Then
- r = r + 1
- ReDim Preserve Arr1(1 To r)
- Arr1(r) = i
- End If
- Next
- For i = 1 To r
- If i <> r Then
- js = Arr1(i + 1) - 1
- Else
- js = UBound(Arr)
- End If
- ks = Arr1(i)
- If ks = js Then Exit Sub
- Cells(ks, 11).Formula = "=sum(r[1]c:r[" & js - ks - 1 & "]c)"
- Cells(ks, 11).AutoFill Cells(ks, 11).Resize(1, 8)
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|