autofill numbering range stick to range

Important Notice

Please note that on 14th December 2023 users will experience an expected outage whilst we make upgrades to our network. We anticipate this process may take a couple of hours and so we apologise in advance for any inconvenience.

  • I want to run an autofill numbering with macro that no blank rows in excel 2016 but if I run the autofill numbering it always stick to range (A1:A102) of my earlier data. How can the auto numbering range change to accomodate different data??


    Sub Macro1()
    ' Macro1 Macro

    ActiveCell.FormulaR1C1 = "1"
    ActiveCell.FormulaR1C1 = "2"
    Selection.AutoFill Destination:=Range("A1:A102")
    End Sub

  • Re: autofill numbering range stick to range


    You do not need a macro for numbering rows ...

    Just go to A1 and input =Row() ... and copy down ... :wink:

    If you really want a macro ...

    Sub Macro1()
    Dim i As Long
      For i = 1 To 102
        Range("A" & i) = i
      Next i
    End Sub

    Hope this will help

    If you feel like saying "Thank You" for the help received, do not hesitate to click the "Smiley" icon, below, in the bottom right corner :)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!