Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Selecting Worksheet Array

Hello,

My workbook has a first sheet that is always the same. I then have VBA that
imports new sheets from workbooks in another folder. I wish to do something
to all those sheets once brought in, but not the first. Of course the number
of sheets (and their names) varies....

How do select a sheet array that automatically starts with the second sheet
and selects all those after it? In other words, how do I select all
worksheets except sheet 1 (not knowing their names or the number)?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Selecting Worksheet Array

Hi Jeff,

One way:

'=============
Public Sub Tester()
Dim i As Long

For i = 2 To ThisWorkbook.Sheets.Count
Sheets(i).Select Replace:=False
Next i

End Sub
'<<=============


---
Regards,
Norman



"JEFF" wrote in message
...
Hello,

My workbook has a first sheet that is always the same. I then have VBA
that
imports new sheets from workbooks in another folder. I wish to do
something
to all those sheets once brought in, but not the first. Of course the
number
of sheets (and their names) varies....

How do select a sheet array that automatically starts with the second
sheet
and selects all those after it? In other words, how do I select all
worksheets except sheet 1 (not knowing their names or the number)?

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selecting Worksheet Array

One way:

Option Explicit
Sub testme()
Dim iCtr As Long
For iCtr = 2 To Sheets.Count
Sheets(iCtr).Select Replace:=CBool(iCtr = 2)
Next iCtr
End Sub




JEFF wrote:

Hello,

My workbook has a first sheet that is always the same. I then have VBA that
imports new sheets from workbooks in another folder. I wish to do something
to all those sheets once brought in, but not the first. Of course the number
of sheets (and their names) varies....

How do select a sheet array that automatically starts with the second sheet
and selects all those after it? In other words, how do I select all
worksheets except sheet 1 (not knowing their names or the number)?

Thanks


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selecting Worksheet Array

Watchout if sheets(1) is the selected sheet.

Norman Jones wrote:

Hi Jeff,

One way:

'=============
Public Sub Tester()
Dim i As Long

For i = 2 To ThisWorkbook.Sheets.Count
Sheets(i).Select Replace:=False
Next i

End Sub
'<<=============

---
Regards,
Norman

"JEFF" wrote in message
...
Hello,

My workbook has a first sheet that is always the same. I then have VBA
that
imports new sheets from workbooks in another folder. I wish to do
something
to all those sheets once brought in, but not the first. Of course the
number
of sheets (and their names) varies....

How do select a sheet array that automatically starts with the second
sheet
and selects all those after it? In other words, how do I select all
worksheets except sheet 1 (not knowing their names or the number)?

Thanks


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Selecting Worksheet Array

Hi Dave,

Watchout if sheets(1) is the selected sheet.



Very true, thank you!

---
Regards,
Norman






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 921
Default Selecting Worksheet Array

That works.... thank you

"Dave Peterson" wrote:

One way:

Option Explicit
Sub testme()
Dim iCtr As Long
For iCtr = 2 To Sheets.Count
Sheets(iCtr).Select Replace:=CBool(iCtr = 2)
Next iCtr
End Sub




JEFF wrote:

Hello,

My workbook has a first sheet that is always the same. I then have VBA that
imports new sheets from workbooks in another folder. I wish to do something
to all those sheets once brought in, but not the first. Of course the number
of sheets (and their names) varies....

How do select a sheet array that automatically starts with the second sheet
and selects all those after it? In other words, how do I select all
worksheets except sheet 1 (not knowing their names or the number)?

Thanks


--

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
Array formulas/selecting data Kalle Excel Worksheet Functions 2 July 14th 09 10:52 AM
Selecting array element. KD[_5_] Excel Programming 0 March 17th 06 06:59 PM
Array Printing (Selecting) Craig[_21_] Excel Programming 1 December 31st 04 07:51 AM
selecting multiple sheets by use of an array? anhjan[_3_] Excel Programming 3 April 8th 04 01:58 AM
Help: selecting part of an array Philbyinsydney Excel Programming 1 March 5th 04 01:15 AM


All times are GMT +1. The time now is 12:49 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"