Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
Selecting Worksheet Array
Hi Dave,
Watchout if sheets(1) is the selected sheet. Very true, thank you! --- Regards, Norman |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Array formulas/selecting data | Excel Worksheet Functions | |||
Selecting array element. | Excel Programming | |||
Array Printing (Selecting) | Excel Programming | |||
selecting multiple sheets by use of an array? | Excel Programming | |||
Help: selecting part of an array | Excel Programming |