VBA动态总和范围

时间:2019-12-29 09:35:52

标签: excel vba

下面是我的代码,请您告诉我如何使用更改或重写以下代码

For y = 34 To 2 Step -1

    If Cells(y, 8) = "" Then
        Cells(y - 1, 8).Select

        Selection.End(xlUp).Select

        myFirstCell = ActiveCell.Address

        Selection.End(xlDown).Select

        myLastCell = ActiveCell.Address

        Cells(y, 8).Select
        ActiveCell.FormulaR1C1 = "=sum(myFirstCell" & ":myLastCell" & ")"

    Else

    End If

Next

0 个答案:

没有答案