ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add/Delete Worksheets and Reset Numbering (https://www.excelbanter.com/excel-programming/302922-add-delete-worksheets-reset-numbering.html)

John[_80_]

Add/Delete Worksheets and Reset Numbering
 
I add sheet2, sheet3, and sheet4 to the current workbook.
Then I delete these new sheets. If I execute the following code:

----------------------
Dim a As Integer

For a = 1 To 10
Sheets.Add
Next a
----------------------

The sheets don't start at Sheet2, like I thought they would. Does
someone have the code handy to "wipe out" the remberance of sheets
that existed but are now deleted.

Thanks
John

Vasant Nanavati

Add/Delete Worksheets and Reset Numbering
 
I don't think there is a straightfoward way to do this without looping
through the sheets, determining what you want the new sheet to be named, and
then renaming it.

--

Vasant

"John" wrote in message
m...
I add sheet2, sheet3, and sheet4 to the current workbook.
Then I delete these new sheets. If I execute the following code:

----------------------
Dim a As Integer

For a = 1 To 10
Sheets.Add
Next a
----------------------

The sheets don't start at Sheet2, like I thought they would. Does
someone have the code handy to "wipe out" the remberance of sheets
that existed but are now deleted.

Thanks
John





All times are GMT +1. The time now is 01:31 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com