|
-
Jul 11th, 2003, 11:52 AM
#1
Thread Starter
Member
SOLVED adding worksheets
I recorded the following macro:
Code:
Sheets("Sheet2").Select
Sheets.Add
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "name"
The problem is that I'm going to be adding multiple sheets. Which brings me to my question: How can I change the name of the sheet that I just added?
Thanks,
Alex
Last edited by LodBot; Jul 14th, 2003 at 10:40 AM.
-
Jul 11th, 2003, 03:40 PM
#2
Excel keeps track of the active worksheets in a workbook within a worksheets collection. One property of this collection is count which you can use to help you here:
VB Code:
Worksheets.Add After:=Worksheets(Worksheets.Count)
Worksheets(Worksheets.Count).Name = "MyNewSheetName"
Here I'm saying "add a new worksheet after the last existing one in this workbook, then go to this new last sheet I just created & change it's name..."
-
Jul 14th, 2003, 10:39 AM
#3
Thread Starter
Member
works 
Thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|