FrenchCAD
Mechanical
- Feb 8, 2002
- 321
Hi,
I'm working on writing a Sub to rename all pages of my woorkbook as "Page i" and including this page number in a cell as well.
The Sub is like follow :
Private Sub Workbook_Open()
For i = 1 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Worksheets(i).Name = "Page " & i
ActiveWorkbook.Worksheets(i).Cells(2, 2) = i
Next i
End Sub
It works all great untill I add or copy a page. When I do so, the function fails when I reopen my workbook.
Any idea?
Cyril Guichard
Mechanical Engineer
I'm working on writing a Sub to rename all pages of my woorkbook as "Page i" and including this page number in a cell as well.
The Sub is like follow :
Private Sub Workbook_Open()
For i = 1 To ActiveWorkbook.Sheets.Count
ActiveWorkbook.Worksheets(i).Name = "Page " & i
ActiveWorkbook.Worksheets(i).Cells(2, 2) = i
Next i
End Sub
It works all great untill I add or copy a page. When I do so, the function fails when I reopen my workbook.
Any idea?
Cyril Guichard
Mechanical Engineer