|
|
|
|
|
|
Excel
|
Auto Row Numbering
|
|
Ease of Use
|
Easy
|
Version tested with
|
2000, 2003
|
Submitted by:
|
lucas
|
Description:
|
When you click any cell in a row, that row is numbered automatically in Column C
|
Discussion:
|
If you are like me and use numbered rows a lot, you probably get tired of typing in each number. Put this script in the code for the sheet you wish to use and start your data in Column D. Each time you type in any cell, that row will be numbered in Column C.
Easy to change which column gets numbered in the script. See comments in the code.
Credit for the original code goes to Aaron Blood
|
Code:
|
instructions for use
|
Put this code In the sheet module:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Dim RowOffset As Long
Dim IndexCol As String
RowOffset = 0
IndexCol = "C"
Intersect(ActiveCell.EntireRow, Columns(IndexCol)).Value = ActiveCell.Row + RowOffset
End Sub
|
How to use:
|
- Right mouse click on the sheet tab for any sheet you wish to auto-number
- select "View Code"
- Paste the code above into the worksheet module and close the VBE
|
Test the code:
|
- Click on any cell of the sheet and your row will be numbered.
|
Sample File:
|
auto_number.zip 6.75KB
|
Approved by mdmackillop
|
This entry has been viewed 438 times.
|
|