Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
If I create 5 tabs based on some variables in one other tab, how would
I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
I'm confused on how you will determine which pages to keep. But by your
desciption tmp = ThisWorkbook.Sheets.Count this tells you how many sheets there are Sheets(1).Delete that will delete a sheet -John "Ardy" wrote: If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
Sub ABCD()
Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
Tom
Thank you.......can You educate me on one thing. Not being a programmer but familiar woth the concepts I fallow all of the logic but get lost in For i = Sheets.Count To 2 Step -1 I undrestand the For statement but don't quit get the 2 step -1, can you shed some light on this...... Regards Ardy Tom Ogilvy wrote: Sub ABCD() Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
it counts backwards.
-- Regards, Tom Ogilvy "Ardy" wrote in message oups.com... Tom Thank you.......can You educate me on one thing. Not being a programmer but familiar woth the concepts I fallow all of the logic but get lost in For i = Sheets.Count To 2 Step -1 I undrestand the For statement but don't quit get the 2 step -1, can you shed some light on this...... Regards Ardy Tom Ogilvy wrote: Sub ABCD() Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
So Is 2 the first tab or the last tab, or How would one determine that
Thanks....... Tom Ogilvy wrote: it counts backwards. -- Regards, Tom Ogilvy "Ardy" wrote in message oups.com... Tom Thank you.......can You educate me on one thing. Not being a programmer but familiar woth the concepts I fallow all of the logic but get lost in For i = Sheets.Count To 2 Step -1 I undrestand the For statement but don't quit get the 2 step -1, can you shed some light on this...... Regards Ardy Tom Ogilvy wrote: Sub ABCD() Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
2 is the second tab from the left - you said you didn't want to do anything
to the first tab, which is 1. So it counts down from the rightmost tab to the left. (assuming you have a version of excel that works from left to right). -- Regards, Tom Ogilvy "Ardy" wrote in message ups.com... So Is 2 the first tab or the last tab, or How would one determine that Thanks....... Tom Ogilvy wrote: it counts backwards. -- Regards, Tom Ogilvy "Ardy" wrote in message oups.com... Tom Thank you.......can You educate me on one thing. Not being a programmer but familiar woth the concepts I fallow all of the logic but get lost in For i = Sheets.Count To 2 Step -1 I undrestand the For statement but don't quit get the 2 step -1, can you shed some light on this...... Regards Ardy Tom Ogilvy wrote: Sub ABCD() Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Delete Tabs
Oh Ok I get it , I modify so it would exempt from the 2 tab........
Tom Ogilvy wrote: 2 is the second tab from the left - you said you didn't want to do anything to the first tab, which is 1. So it counts down from the rightmost tab to the left. (assuming you have a version of excel that works from left to right). -- Regards, Tom Ogilvy "Ardy" wrote in message ups.com... So Is 2 the first tab or the last tab, or How would one determine that Thanks....... Tom Ogilvy wrote: it counts backwards. -- Regards, Tom Ogilvy "Ardy" wrote in message oups.com... Tom Thank you.......can You educate me on one thing. Not being a programmer but familiar woth the concepts I fallow all of the logic but get lost in For i = Sheets.Count To 2 Step -1 I undrestand the For statement but don't quit get the 2 step -1, can you shed some light on this...... Regards Ardy Tom Ogilvy wrote: Sub ABCD() Dim i As Long Application.DisplayAlerts = False For i = Sheets.Count To 2 Step -1 Sheets(i).Delete Next Application.DisplayAlerts = True End Sub -- Regards, Tom Ogilvy "Ardy" wrote in message ps.com... If I create 5 tabs based on some variables in one other tab, how would I delete the created tabs. i.e I have TAB 1, in this tab I have code (Thanks to this group) I will create TAB 2, 3, 4, 5. The numbers of tabs are unknown it depends on the list on tab 1. I need to delete tab 2, 3, 4, 5 but not 1. So the code I assume needs to make a list of all existing tabs have an exception not to delete 1 and delete the rest. Ardy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2002: Can I delete tabs at one go ? | Excel Discussion (Misc queries) | |||
Not a novice - can't delete tabs! | Excel Discussion (Misc queries) | |||
Delete Tabs | Excel Programming | |||
How can I find and delete tabs and carriage returns ? | Excel Discussion (Misc queries) | |||
Macro to force delete tabs | Excel Programming |