Macro To fill down Numbers needed

thunder_anger

Board Regular
Joined
Sep 27, 2009
Messages
206
Hi there

is there a way to fill down numbers according to a number in another cell

E.g

if entered the number 30 in cell B1
Excel to fill from A1 to A30 with numbers
1
2
3
4
....
30
is that possible
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Assuming B1 will be at least 1...

In A1, put 1

In A2 and filled down as far as needed to meet the maximum number you'll put in B1
=IF(A1>=B$1,"",A1+1)


Hope that helps.
 
Upvote 0
Why?

Code:
Sub FillNumbers()
Dim i As Long
For i = 1 to Range("B1").Value
    Cells(i,"A").Value = i
Next i
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,561
Messages
6,179,521
Members
452,923
Latest member
JackiG

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