Numbering rows

Carole

New Member
Joined
Apr 2, 2002
Messages
8
I want to number rows in my spreadsheet. How can I get the rows numbered, to appear automatically. Then if I instert a row it alters the numbering accodingly?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Probably the easiest way is to use the ROW worksheet function, and then add or subtract a fixed number to get where you want. For example, if you wanted to start your numbers at row 10 with the number 1 you'd put the following in cell A10:

=ROW(A10)-9

Then copy this formula down until you have as many rows/numbers as you want.

Penfold
 
Upvote 0
Hi Carole,

If you want to do it with a Commandbutton try
this:

Private Sub CommandButton_Click()
Dim ColA As Range, rw As Range, n%
Set ColA = Range("A6")
Set rw As = ColA.EntireRow
Do Until Application.WorksheetFunction.CountA
_ (rw) = 0
n = n + 1
ColA.Value = n
Set ColA = ColA.Offset(1, 0)
Set rw = rw.Offset(1, 0)
Loop
End Sub

The above code starts the numbering sequence
in Col A, Row 6 You can modify as needed

James
 
Upvote 0

Forum statistics

Threads
1,214,414
Messages
6,119,375
Members
448,888
Latest member
Arle8907

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