#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 125
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 136
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002: Can I delete tabs at one go ? Mr. Low Excel Discussion (Misc queries) 2 July 24th 09 05:16 PM
Not a novice - can't delete tabs! Sherri Excel Discussion (Misc queries) 1 April 9th 09 02:36 PM
Delete Tabs dogpigfish Excel Programming 1 December 29th 05 06:56 PM
How can I find and delete tabs and carriage returns ? JeffEE Excel Discussion (Misc queries) 1 November 11th 05 02:47 PM
Macro to force delete tabs Randy[_11_] Excel Programming 1 August 13th 04 04:43 PM


All times are GMT +1. The time now is 02:02 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"