Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 425
Default group all sheets after

Need to know how to express the following....


group all sheets in a workbook after sheet "apples"
or
group all sheets in a workbook after the 3rd sheet in workbook.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default group all sheets after

Option Explicit
Sub testme()
Dim FirstIndex As Long
Dim iCtr As Long

FirstIndex = Sheets("Apples").Index 'or 3 or 4

For iCtr = FirstIndex To Sheets.Count
Sheets(iCtr).Select Replace:=CBool(iCtr = FirstIndex)
Next iCtr

End Sub

After the 3rd means include the third? Start with the first sheet or index that
you want grouped.

And After means to the right, correct?

"J.W. Aldridge" wrote:

Need to know how to express the following....

group all sheets in a workbook after sheet "apples"
or
group all sheets in a workbook after the 3rd sheet in workbook.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default group all sheets after

here's another way, there're always multiple ways to do things.

Option Explicit

Sub test()
Dim i As Long
Application.ScreenUpdating = False
For i = Worksheets("Apples").Index To Worksheets.Count
Worksheets(i).Select False
Next
Application.ScreenUpdating = True
End Sub

Sub test2()
Dim i As Long
Application.ScreenUpdating = False
For i = 3 To Worksheets.Count
Worksheets(i).Select False
Next
Application.ScreenUpdating = True
End Sub

--

Gary Keramidas
Excel 2003


"J.W. Aldridge" wrote in message
...
Need to know how to express the following....


group all sheets in a workbook after sheet "apples"
or
group all sheets in a workbook after the 3rd sheet in workbook.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default group all sheets after

This will work if the current selected sheet(s) is/are to the left of that
Apples/3 sheet.

Gary Keramidas wrote:

here's another way, there're always multiple ways to do things.

Option Explicit

Sub test()
Dim i As Long
Application.ScreenUpdating = False
For i = Worksheets("Apples").Index To Worksheets.Count
Worksheets(i).Select False
Next
Application.ScreenUpdating = True
End Sub

Sub test2()
Dim i As Long
Application.ScreenUpdating = False
For i = 3 To Worksheets.Count
Worksheets(i).Select False
Next
Application.ScreenUpdating = True
End Sub

--

Gary Keramidas
Excel 2003

"J.W. Aldridge" wrote in message
...
Need to know how to express the following....


group all sheets in a workbook after sheet "apples"
or
group all sheets in a workbook after the 3rd sheet in workbook.


--

Dave Peterson
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
Name a group of sheets Mary Ann Excel Discussion (Misc queries) 2 November 26th 09 10:59 PM
sort between a group of sheets tkincaid Excel Worksheet Functions 8 January 6th 09 03:42 PM
working with a group of sheets GKeramidas Excel Programming 4 September 4th 06 05:05 PM
Group Sheets Brian Keanie Excel Discussion (Misc queries) 10 January 1st 05 08:34 PM
Need group all sheets in a workbook TOMB Excel Programming 2 November 16th 04 03:58 PM


All times are GMT +1. The time now is 07:17 PM.

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"