This will insert a new worksheet after sheet 1. But how do you add a new ws to the end?
[VBA] Worksheets.Add after:=Worksheets(1)[/VBA]
This will insert a new worksheet after sheet 1. But how do you add a new ws to the end?
[VBA] Worksheets.Add after:=Worksheets(1)[/VBA]
You just specify that in the After portion ..
[vba]Worksheets.Add After:=Worksheets(Worksheets.Count)[/vba]
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Try this link. I think it will help.
http://www.functionx.com/excel/vba/Lesson07.htm
Peace of mind is found in some of the strangest places.
Try this QuickDraw
[VBA]
Dim TotalSheets As Variant
TotalSheets = Worksheets.Count
Sheets("Invoice").Select
Sheets("Invoice").Copy After:=Worksheets(TotalSheets)
[/VBA]
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
[VBA] Sheets("Sheet***").Move After:=Sheets(123)[/VBA]
Hi
Add this line to your script after adjusting for the name of the sheet you have just created and for the name of the last current sheet - it will then move the sheet you have just made to the end.
Is this what you wanted?
Cheers
Amanda Ps Just wait though, because one of the experts will be laughing at me and leap in to tell you a better way to do it. So hold on.
Sorry,
Mine is for copying a sheet to the end....try this for a new sheet using Zacks code too
[VBA]
Dim TotalSheets As Variant
TotalSheets = Worksheets.Count
Worksheets.Add After:=Worksheets(TotalSheets)
[/VBA]
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln
Thanks for all of the responses... worksheets.count is what I needed.
Cheers
Hmm, why even use the variable? Wouldn't it suffice like what I posted above? Now if that variable was to be used again, I could see the use of it..
Regards, Zack Barresse
Check out the KB! :|: BOARD TAGS: WHAT ARE THEY AND HOW DO I USE THEM
What is a Microsoft MVP? | Free Microsoft Courses | My Book on Excel Tables
Of course your right Zack......sorry if I confused the issue
Steve
"Nearly all men can stand adversity, but if you want to test a man's character, give him power."
-Abraham Lincoln