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

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
11,718
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
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
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
11,718
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
You are very welcome. :)
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,595
Messages
5,832,634
Members
430,149
Latest member
amitk1

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
Top