Macro to create series of number using a start and end number

ispi2071

New Member
Joined
Feb 22, 2019
Messages
2
Hoping someone can assist me doing this little faster using a Macro or script.

I know I can type a starting number in any given cell. Then I can click Fill > Series > Select Columns and enter the Stop Value and Excel will build the series for me. I am looking for a faster way of doing this where I can enter the start number in cell A1 and the end number in cell B1. I would like the Macro/script to build the series starting in cell A2 and stop at the value in B1 using step value 1.

The reason I need done is I have a set of numbers from another application that only gives me the start and end value of ranges of numbers. I have about 500 different ranges and don't want keep doing Fill > Series > over and over.

Hope someone can guide me.

Thanks
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Try:
Code:
Sub FillSequentialNumbers()
    With Range("A2")
        .Value = Range("A1").Value
        .AutoFill Destination:=Range("A2").Resize(Range("B1").Value - Range("A1").Value + 1), Type:=xlFillSeries
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,170
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top