# Auto Numbering

#### vijay2482

##### Board Regular
i have a worksheet with few rows..
in column B i want to number the rows from 1 to n...

how to achieve this???

### Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Maybe

=ROW()

#### tekkiegurl

##### New Member
you could write 1 to 3 on the 3 rows then highlight the it and drag it down.

#### vijay2482

##### Board Regular
thanks for the replies..

how to obtain the result using macro???

#### Yard

##### Well-known Member
How far down do you want to number? To number column B until the last entry in column A:

Code:
Sub AutoNum()

Dim rngStart, rngC As Range

Set rngStart = Range(Cells(1, "B"), Cells(Cells(Rows.Count, "A").End(xlUp).Row, "B"))

Application.ScreenUpdating = False

For Each rngC In rngStart
rngC.Value = rngC.Row
Next rngC

Application.ScreenUpdating = True

End Sub

#### vijay2482

##### Board Regular
thanks...
it enters the number of the row...

i want the numbers from 1 to n to be entered in column B starting from row 4

i did a small modification to ur code and got the result in column B line number starting from 4...

i want it to start at 1 in column B row 4

Code:
Sub AutoNum()
Dim rngStart, rngC As Range
Set rngStart = Range(Cells(4, "B"), Cells(Cells(Rows.Count, "A").End(xlUp).row, "B"))
Application.ScreenUpdating = False
For Each rngC In rngStart
rngC.Value = rngC.row
Next rngC
Application.ScreenUpdating = True
End Sub

#### Yard

##### Well-known Member
Rich (BB code):
Sub AutoNum()
Dim rngStart, rngC As Range
Set rngStart = Range(Cells(4, "B"), Cells(Cells(Rows.Count, "A").End(xlUp).row, "B"))
Application.ScreenUpdating = False
For Each rngC In rngStart
rngC.Value = rngC.row-3
Next rngC
Application.ScreenUpdating = True
End Sub

#### vijay2482

##### Board Regular
thanks a lot..............

that works perfect..
u r a genious

thank you once again for helping...

Last edited:

Replies
11
Views
321
Replies
2
Views
124
Replies
2
Views
157
Replies
3
Views
254
Replies
6
Views
312

1,195,943
Messages
6,012,431
Members
441,700
Latest member
Warbo

### 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.

### Which adblocker are you using?

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

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