Excel VBA Macro to Enter Numbers 1 to 48 from Any Cell
Question details
The user needs an Excel VBA macro that enters numbers 1 through 48 downward from the selected cell.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user wants to run the same macro from different starting cells rather than use a fixed worksheet range.
- Observed behavior
- The desired result is a column of consecutive numbers from 1 to 48 beginning at the active cell.
Choose a starting cell with at least 47 rows available beneath it, and check that the target cells can be edited. The macro will overwrite existing values in those 48 cells.
Fill 1 to 48 Downward from the Active Cell with VBA
Use this macro when the starting cell changes each time you run it.
The macro uses ActiveCell as its starting point and Offset to write each number one row below the previous one.
In Excel, open the Developer tab and select Visual Basic. If the tab is hidden, enable it through Excel's ribbon settings.
In the VBA editor, select Insert > Module and paste: Sub FillNumbers() Dim i As Long For i = 1 To 48 ActiveCell.Offset(i - 1, 0).Value = i Next i End Sub
Return to the worksheet and click the cell where the number 1 should appear.
Select Developer > Macros, choose FillNumbers, and select Run. Excel fills the selected cell and the 47 cells below it.

Create the Same Number Series in WPS Spreadsheets
Use the fill handle in WPS Spreadsheets to enter 1 through 48 from any suitable starting cell without writing a macro.
- 1. Open your spreadsheet: Open WPS Spreadsheets and create a workbook or open an existing Excel file.
- 2. Enter the first two numbers: Click the starting cell, type 1, and enter 2 in the cell directly below it.
- 3. Select both cells: Drag across the two cells containing 1 and 2 to select them.
- 4. Extend the series: Drag the fill handle at the bottom-right corner of the selection downward until the series reaches 48.

Frequently Asked Questions
How do I change the starting cell for the macro?
Click a different worksheet cell before selecting Developer > Macros and running FillNumbers. The selected cell receives 1.
Will the macro overwrite existing data?
Yes. It replaces values in the active cell and the 47 cells below it, so check the target range before running it.
Why can't the macro fill from the bottom of the worksheet?
The starting cell must have at least 47 worksheet rows beneath it. Choose a higher starting cell if the series would extend beyond the last row.
How can I keep the macro in my workbook?
In Excel, select File > Save As and choose Excel Macro-Enabled Workbook (*.xlsm). A standard XLSX file does not retain VBA macros.




