Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Please help to delete all the sheets in a workbook except the First sheet
(i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub delsheets()
Dim sh as Sheet For Each sh in ActiveWorkbook.Sheets If sh.Name<"Sheet1" Then sh.Delete End If Next sh End Sub On 3 Lis, 09:46, Ms-Exl-Learner wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub SheetRemover()
k = Sheets.Count For i = k To 2 Step -1 Sheets(i).Delete Next End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you its working fine but if I run the Macro then its asking me to
Confirm Do you want to delete this sheet like that for each and every worksheet before deleting. I am having 200 sheets for 200 times I need to click or Press enter for deleting the sheets. Please help me€¦ -------------------- (Ms-Exl-Learner) -------------------- "Gary''s Student" wrote: Sub SheetRemover() k = Sheets.Count For i = k To 2 Step -1 Sheets(i).Delete Next End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Not for 200 times 199 times. Please set the macro without any message box
confirmation. -------------------- (Ms-Exl-Learner) -------------------- "Ms-Exl-Learner" wrote: Thank you its working fine but if I run the Macro then its asking me to Confirm Do you want to delete this sheet like that for each and every worksheet before deleting. I am having 200 sheets for 200 times I need to click or Press enter for deleting the sheets. Please help me€¦ -------------------- (Ms-Exl-Learner) -------------------- "Gary''s Student" wrote: Sub SheetRemover() k = Sheets.Count For i = k To 2 Step -1 Sheets(i).Delete Next End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Sub SheetRemover()
k = Sheets.Count Application.DisplayAlerts = False For i = k To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Not for 200 times 199 times. Please set the macro without any message box confirmation. -------------------- (Ms-Exl-Learner) -------------------- "Ms-Exl-Learner" wrote: Thank you its working fine but if I run the Macro then its asking me to Confirm Do you want to delete this sheet like that for each and every worksheet before deleting. I am having 200 sheets for 200 times I need to click or Press enter for deleting the sheets. Please help me€¦ -------------------- (Ms-Exl-Learner) -------------------- "Gary''s Student" wrote: Sub SheetRemover() k = Sheets.Count For i = k To 2 Step -1 Sheets(i).Delete Next End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you very much its working fine now€¦
-------------------- (Ms-Exl-Learner) -------------------- "Gary''s Student" wrote: Sub SheetRemover() k = Sheets.Count Application.DisplayAlerts = False For i = k To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Not for 200 times 199 times. Please set the macro without any message box confirmation. -------------------- (Ms-Exl-Learner) -------------------- "Ms-Exl-Learner" wrote: Thank you its working fine but if I run the Macro then its asking me to Confirm Do you want to delete this sheet like that for each and every worksheet before deleting. I am having 200 sheets for 200 times I need to click or Press enter for deleting the sheets. Please help me€¦ -------------------- (Ms-Exl-Learner) -------------------- "Gary''s Student" wrote: Sub SheetRemover() k = Sheets.Count For i = k To 2 Step -1 Sheets(i).Delete Next End Sub -- Gary''s Student - gsnu200908 "Ms-Exl-Learner" wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) -------------------- |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
forgot to include the
Application.DisplayAlerts = False .... Application.DisplayAlerts = True part On 3 Lis, 10:10, Jarek Kujawa wrote: Sub delsheets() Dim sh as Sheet For Each sh in ActiveWorkbook.Sheets If sh.Name<"Sheet1" Then sh.Delete End If Next sh End Sub On 3 Lis, 09:46, Ms-Exl-Learner wrote: Please help to delete all the sheets in a workbook except the First sheet (i.e.) Sheet1. Thanks for reading. -------------------- (Ms-Exl-Learner) --------------------- Ukryj cytowany tekst - - Pokaż cytowany tekst - |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Form Code Required | New Users to Excel | |||
Another VB Code Required | Excel Discussion (Misc queries) | |||
VB Code Required | Excel Discussion (Misc queries) | |||
code is not to work on sheet1 | New Users to Excel | |||
How do I set up a workbook so changing Sheet1 changes all sheets? | Excel Worksheet Functions |