Worksheet numbering

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to number a working sheet and have that number automatically
change each time the excel document is opened?
 
You can do it--but remember that the value doesn't get saved if the workbook is
closed without saving.

And lots of times, people open the wrong workbook and close it immediately.

But if you add this code to a General module of your workbook's project:

Option Explicit
Sub auto_open()

With ThisWorkbook.Worksheets("sheet1").Range("a1")
If IsNumeric(.Value) Then
.Value = .Value + 1
Else
.Value = 1 'start again??
End If
End With

ThisWorkbook.Save

End Sub

It adds one to the cell and saves the file--well if macros are running when the
user opens the workbook.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm
 
I am really sorry but I don't understand what I have to do to get it to work.
Please could you explain again in laymans terms?

Thanks
 
hi, press ALT+F11, copy and paste the module that Dave gave you.

hope this helps
Regards from Brazil - going to the 6th
Marcelo

"leah" escreveu:
 
I have followed your instructions but still nothing is happening. I am
relatively new to formulas and therefore do not understand fully what I need
to do. Any additional help would be much appreciated.
 
This is a macro that runs each time the workbook is opened. So if you've set it
up ok, then you'll have to close and reopen the workbook to see the results.

If you're having trouble setting it up, make sure you read David McRitchie's
notes.
 

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

Back
Top