- Sub 多选()
- Dim a%, i%, j%, h%, h1%, hs%, hh%, arr, brr(1 To 1, 1 To 4)
- h1 = Selection.Areas(1)(1).Row
- For a = 1 To Selection.Areas.Count
- h = Selection.Areas(a)(1).Row
- hs = Selection.Areas(a).Rows.Count
- arr = Cells(h, 4).Resize(hs, 4)
- For j = 1 To 4
- If j <> 2 Then
- For i = 1 To hs
- brr(1, j) = brr(1, j) + arr(i, j)
- Next
- End If
- Next
- Cells(h, 4).Resize(hs, 4) = ""
- Next
- brr(1, 2) = (brr(1, 3) + brr(1, 4)) / brr(1, 1)
- Cells(h1, 4).Resize(1, 4) = brr
- '删除空白行
- hh = Cells(Cells.Rows.Count, 4).End(3).Row
- For i = hh To h1 Step -1
- If Cells(i, 4) = "" Then Cells(i, 4).EntireRow.Delete
- Next
- Cells(Selection.Areas(1)(1).Row, 4).Select
- End Sub
复制代码 自己做了一个 |