Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Selecting a group of tabs regardless of name and amount

Hi, I am looking for a piece of code that can pick up all tabs/sheets after
the tab where the button is located to run the code, regardless of name and
number of tabs/sheets. is this possible?
Reason being: The first 2 tabs will be unchanged, but the workbook can have
different amounts of tabs with different names, and I want to select all the
tabs so that I can format all at the same time (using code)
Many thanks
John
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Selecting a group of tabs regardless of name and amount


The following code will put the names of the worksheet to the right of
Sheet3 in the array named Arr and then select those sheets.

Dim N As Long
Dim Arr() As String
With ThisWorkbook.Worksheets
ReDim Arr(.Item("Sheet3").Index + 1 To .Count)
For N = .Item("Sheet3").Index + 1 To .Count
Arr(N) = .Item(N).Name
Next N
End With
ThisWorkbook.Worksheets(Arr).Select

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Fri, 17 Oct 2008 10:25:01 -0700, JohnUK
wrote:

Hi, I am looking for a piece of code that can pick up all tabs/sheets after
the tab where the button is located to run the code, regardless of name and
number of tabs/sheets. is this possible?
Reason being: The first 2 tabs will be unchanged, but the workbook can have
different amounts of tabs with different names, and I want to select all the
tabs so that I can format all at the same time (using code)
Many thanks
John

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Selecting a group of tabs regardless of name and amount

you can see if this works for you:

Sub test()
Dim i As Long
For i = ActiveSheet.Index + 1 To Worksheets.Count
Worksheets(i).Select False
Next
End Sub

--


Gary

"JohnUK" wrote in message
...
Hi, I am looking for a piece of code that can pick up all tabs/sheets
after
the tab where the button is located to run the code, regardless of name
and
number of tabs/sheets. is this possible?
Reason being: The first 2 tabs will be unchanged, but the workbook can
have
different amounts of tabs with different names, and I want to select all
the
tabs so that I can format all at the same time (using code)
Many thanks
John



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Selecting a group of tabs regardless of name and amount

Thanks guys, they both worked as equally as well
Regards
John


"Gary Keramidas" wrote:

you can see if this works for you:

Sub test()
Dim i As Long
For i = ActiveSheet.Index + 1 To Worksheets.Count
Worksheets(i).Select False
Next
End Sub

--


Gary

"JohnUK" wrote in message
...
Hi, I am looking for a piece of code that can pick up all tabs/sheets
after
the tab where the button is located to run the code, regardless of name
and
number of tabs/sheets. is this possible?
Reason being: The first 2 tabs will be unchanged, but the workbook can
have
different amounts of tabs with different names, and I want to select all
the
tabs so that I can format all at the same time (using code)
Many thanks
John




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
I wish to group my worksheets under group tabs Art Excel Worksheet Functions 1 February 4th 10 09:37 PM
Selecting the one with the bigest amount Ruslan Excel Programming 5 April 20th 07 01:55 PM
I wish to group my worksheets under group tabs CSI Excel Worksheet Functions 5 October 19th 06 09:25 PM
Increase group of numbers by same amount Chrissy Excel Worksheet Functions 6 July 21st 06 11:46 PM
Selecting a group of sheet tabs Conan Kelly Excel Programming 1 November 15th 04 03:25 AM


All times are GMT +1. The time now is 04:10 PM.

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

About Us

"It's about Microsoft Excel"