Forum Discussion

Anonymous's avatar
Anonymous
May 31, 2017
Solved

VBA to copy a value until the value changes

Hello. First I must admit, I am not a VBA programmer, but aspire to learn.  I have a complex sales report that is saved in Excel spreadsheet format, with several sub-totals for customer and product....
  • Hi to all!

     

    With this code, you can do it easily:

     

    Sub FillRange()
        With Range("A2:A10")
            .SpecialCells(4) = "=R[-1]C"
            .Value = .Value
        End With
    End Sub

    Note: Replace the Range("A2:A10") for your range.

     

    Blessings!

Resources