Auto Fill Cells with specific numbers.

mattstopel

New Member
Joined
Jun 27, 2018
Messages
10
Hi all,

A pretty simple one but in need of advice.

The quickest way to populate cells P1:P25 with values 1-25.

I recorded the following macro and am using that, but i am sure there is a quicker way to generate the numbers.

Code:
Sub record1_25()
'
' record25 Macro
'
'
    Range("P1").Select
    ActiveCell.FormulaR1C1 = "1"
    Range("P2").Select
    ActiveCell.FormulaR1C1 = "2"
    Range("P1:P2").Select
    Selection.AutoFill Destination:=Range("P1:P25"), Type:=xlFillDefault
    Range("P1:P25").Select


End Sub

Thanks in advanced.
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Try this:
Code:
[LEFT][COLOR=#222222][FONT=Tahoma]Sub record1_25()[/FONT][/COLOR]
[COLOR=#222222][FONT=Tahoma]'Modified 7/2/18 10:20 PM EDT[/FONT][/COLOR]
[COLOR=#222222][FONT=Tahoma]    Range("P1").Value = "1"[/FONT][/COLOR]
[COLOR=#222222][FONT=Tahoma]    Range("P2").Value = "2"[/FONT][/COLOR]
[COLOR=#222222][FONT=Tahoma]    Range("P1:P2").AutoFill Destination:=Range("P1:P25"), Type:=xlFillDefault[/FONT][/COLOR]
[COLOR=#222222][FONT=Tahoma]End Sub[/FONT][/COLOR][/LEFT]
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
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