Auto numbering in Excel

G

Gregg Y

I would like to know if anyone knows how to create a auto numbering formula
in a cell so that when you open the workbook/worksheet each time it either
populates into the cell you want. Can this be a formula? Do I have to
create a macro?
Using Excel 2003
thanks.s
 
L

Luke M

You'll need to use a macro. Open the VBA editor (Alt+F11) and go the the
ThisWorkbook sheet.
Paste this code in:

Private Sub Workbook_Open()
'Change Sheet name and Range to desired values
Sheets("Sheet1").Range("A2").Value = Sheets("Sheet1").Range("A2").Value + 1
End Sub

If you want the number to increase everytime the sheet is selected, go to
the apprpriate sheet module in the VBA editor, and paste this:

Private Sub Worksheet_Activate()
'Change Range callout as deisred
Range("A2").Value = Range("A2").Value + 1
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top