View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Dave Peterson
 
Posts: n/a
Default Worksheet numbering

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

leah wrote:

Is it possible to number a working sheet and have that number automatically
change each time the excel document is opened?


--

Dave Peterson