(Solved) – VBA dynamic sum range [closed]

  • by
(solved)-–-vba-dynamic-sum-range-[closed]

My code is below can you please let me know how to use change or rewrite the below code

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

Leave a Reply

Your email address will not be published. Required fields are marked *