I'm looking for a macro that will insert/add a new worksheet, and then move that newly created worksheet to the end of the workbook. Sounds simple but I can't figure out how to do it.
TIA!!
I'm looking for a macro that will insert/add a new worksheet, and then move that newly created worksheet to the end of the workbook. Sounds simple but I can't figure out how to do it.
TIA!!
Last edited by papaexcel; 05-20-2009 at 11:27 AM.
![]()
Sub AddSheetAndMoveToEnd() Sheets.Add ActiveSheet.Move after:=Worksheets(Worksheets.Count) End Sub
Rule 1: Never merge cells
Rule 2: See rule 1
"Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".
Perfect! Thanks!
One other request...I also want a macro that will delete all existing worksheets in a workbook (sometimes as many as 30 worksheets) except for Sheet1 and Sheet2.
Again, TIA!!
![]()
Sub DeleteAllSheets() 'Deletes all but 1st two sheets Application.DisplayAlerts = False For lp = Worksheets.Count To 3 Step -1 Sheets(lp).Delete Next Application.DisplayAlerts = True End Sub
thanks, works great.
I found out the following works equally as well...
![]()
Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name <> "Sheet1" And ws.Name <> "Sheet2" Then ws.Delete Next Application.DisplayAlerts = True
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks