PC Review


Reply
 
 
Ardy
Guest
Posts: n/a
 
      8th Dec 2006
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 With Quote
 
 
 
 
=?Utf-8?B?Sm9obiBCdW5keQ==?=
Guest
Posts: n/a
 
      8th Dec 2006
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
>
>

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      8th Dec 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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 With Quote
 
Ardy
Guest
Posts: n/a
 
      8th Dec 2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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 With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      8th Dec 2006
it counts backwards.

--
Regards,
Tom Ogilvy


"Ardy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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 With Quote
 
Ardy
Guest
Posts: n/a
 
      8th Dec 2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > 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 With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      9th Dec 2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > 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" <(E-Mail Removed)> wrote in message
>> >> news:(E-Mail Removed)...
>> >> > 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 With Quote
 
Ardy
Guest
Posts: n/a
 
      10th Dec 2006
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" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> >> news:(E-Mail Removed)...
> >> > 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" <(E-Mail Removed)> wrote in message
> >> >> news:(E-Mail Removed)...
> >> >> > 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Tabs JohnUK Microsoft Excel Programming 2 19th Jan 2010 04:51 PM
Not a novice - can't delete tabs! Sherri Microsoft Excel Misc 1 9th Apr 2009 02:36 PM
Delete tabs Cruisinid Microsoft Access Forms 1 5th Sep 2008 07:34 PM
Delete Unwanted Tabs binder Windows XP Messenger 1 18th Aug 2006 10:39 PM
Delete Tabs =?Utf-8?B?ZG9ncGlnZmlzaA==?= Microsoft Excel Programming 1 29th Dec 2005 06:56 PM


Features
 

Advertising
 

Newsgroups
 


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