Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() HI I'm hoping someone can help with a short routine. I need to check that there are 2 worksheets present in the workbook. If there is only one , then a second has to be added to the end. So tabs : Sheet1 Becomes Sheet1 Sheet2 If there are more than 2 then the additional ones should be deleted form the end. So tabs: Sheet1 Sheet2 Sheet3 ... Becomes Sheet1 Sheet2 Grateful for your help. Best Wishes |
#2
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Hi Colin,
Am Wed, 18 Jun 2014 14:57:38 +0100 schrieb Colin Hayes: Sheet1 Becomes Sheet1 Sheet2 Sheet1 Sheet2 Sheet3 ... Becomes Sheet1 Sheet2 try: Sub SheetCheck() Dim i As Long Select Case Sheets.Count Case 1 Sheets.Add after:=Sheets(Sheets.Count) Case Is 2 For i = Sheets.Count To 3 Step -1 Application.DisplayAlerts = False Sheets(i).Delete Application.DisplayAlerts = True Next End Select End Sub Regards Claus B. -- Vista Ultimate / Windows7 Office 2007 Ultimate / 2010 Professional |
#3
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]() Sub SheetCheck() Dim i As Long Select Case Sheets.Count Case 1 Sheets.Add after:=Sheets(Sheets.Count) Case Is 2 For i = Sheets.Count To 3 Step -1 Application.DisplayAlerts = False Sheets(i).Delete Application.DisplayAlerts = True Next End Select End Sub Regards Claus B. Hi Claus OK thanks for this. Perfect first time. Best Wishes , Colin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check date range on three sheets? | Excel Discussion (Misc queries) | |||
Basic example formula needed to link between sheets add/subtract | New Users to Excel | |||
How do I check several sheets for data in a particular cell? | Excel Discussion (Misc queries) | |||
Check - Similar Row contents - Different Sheets | Excel Programming | |||
How to subtract many cell areas (between sheets) | Excel Programming |