(Solved) – VBA setting values to a column to the last row of another column

  • by

I am trying to make a VBA that gives certain columns a value up until the last row of the first column. This is my code:

Sub Macro8()
' Macro8 Macro

        Dim sh As Worksheet, lastRow As Long
        Set sh = ActiveWorkbook.ActiveSheet

        lastRow = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row
        sh.Range("D" & lastRow).Value = 8.5
        sh.Range("E" & lastRow).Value = 6

End Sub

I only seem to get the value on the last row of data, but I want it from the 2nd row to the last row of the first column

Leave a Reply

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