Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Manage groups of WS

Life used to be so simple. Not so now.

I used to have a lovely list of 31 WS and have my code cycle through each
one to find some information. Now I find that these 31 WS are actually three
Groups of 8 WS + one of 7 WS. What I used to do on all 31 WS now has to be
done on each Group.

I've had no problem initializing the four groups Dimmed as Sheets, and named
shtList2000, shtList2001, etc. However, I am having the very dickens of a
time trying to build a For Each..Next Loop that will work with the groups.

All contributions gratefully accepted!
--
Dave
Temping with Staffmark
in Rock Hill, SC
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Manage groups of WS

One way:

Dim vSheets As Variant
Dim i As Long
Dim j As Long
vSheets = Array(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", _
"Sheet5", "Sheet6", "Sheet7", "Sheet8"), _
Array("Sheet9", "Sheet10", "Sheet11", "Sheet12", _
"Sheet13", "Sheet14", "Sheet15", "Sheet16"), _
Array("Sheet17", "Sheet18", "Sheet19", "Sheet20", _
"Sheet21", "Sheet22", "Sheet23", "Sheet24"), _
Array("Sheet25", "Sheet26", "Sheet27", "Sheet28", _
"Sheet29", "Sheet30", "Sheet31"))
For i = LBound(vSheets) To UBound(vSheets)
For j = LBound(vSheets(i)) To UBound(vSheets(i))
Worksheets(vSheets(i)(j)).Range("A1").Value = _
"Group " & i & " Sheet " & j
Next j
Next i


In article ,
Dave Birley wrote:

Life used to be so simple. Not so now.

I used to have a lovely list of 31 WS and have my code cycle through each
one to find some information. Now I find that these 31 WS are actually three
Groups of 8 WS + one of 7 WS. What I used to do on all 31 WS now has to be
done on each Group.

I've had no problem initializing the four groups Dimmed as Sheets, and named
shtList2000, shtList2001, etc. However, I am having the very dickens of a
time trying to build a For Each..Next Loop that will work with the groups.

All contributions gratefully accepted!

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default Manage groups of WS


Thanks -- even as you were posting that, I came up with a different one (BTW
the inner loop "J" is handled in a sub-process), but I shall hang on to yours
because I haven't been using LBound and UBound, and need to learn more about
them.

My solution was to do..

For intSheetsIndex = 1 to 4
Select Case intSheetsIndex
Case 1
Set shtCurSheet = shtList2003
Case 2
<etc.
End Select
Next intSheetsIndex
--
Dave
Temping with Staffmark
in Rock Hill, SC


"JE McGimpsey" wrote:

One way:

Dim vSheets As Variant
Dim i As Long
Dim j As Long
vSheets = Array(Array("Sheet1", "Sheet2", "Sheet3", "Sheet4", _
"Sheet5", "Sheet6", "Sheet7", "Sheet8"), _
Array("Sheet9", "Sheet10", "Sheet11", "Sheet12", _
"Sheet13", "Sheet14", "Sheet15", "Sheet16"), _
Array("Sheet17", "Sheet18", "Sheet19", "Sheet20", _
"Sheet21", "Sheet22", "Sheet23", "Sheet24"), _
Array("Sheet25", "Sheet26", "Sheet27", "Sheet28", _
"Sheet29", "Sheet30", "Sheet31"))
For i = LBound(vSheets) To UBound(vSheets)
For j = LBound(vSheets(i)) To UBound(vSheets(i))
Worksheets(vSheets(i)(j)).Range("A1").Value = _
"Group " & i & " Sheet " & j
Next j
Next i


In article ,
Dave Birley wrote:

Life used to be so simple. Not so now.

I used to have a lovely list of 31 WS and have my code cycle through each
one to find some information. Now I find that these 31 WS are actually three
Groups of 8 WS + one of 7 WS. What I used to do on all 31 WS now has to be
done on each Group.

I've had no problem initializing the four groups Dimmed as Sheets, and named
shtList2000, shtList2001, etc. However, I am having the very dickens of a
time trying to build a For Each..Next Loop that will work with the groups.

All contributions gratefully accepted!


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
manage add-ons under tools barman New Users to Excel 2 July 2nd 09 10:54 PM
Excel - Sorting groups in groups due to subtotaling [email protected] Excel Worksheet Functions 3 April 4th 08 06:13 PM
Custom Add-in - How to Manage Peter Owitz[_2_] Excel Programming 3 April 13th 07 02:00 AM
how do i manage without having to retype Cynthia Excel Discussion (Misc queries) 3 August 24th 06 06:42 PM
how do i view all groups under excel in google groups JulieD Excel Discussion (Misc queries) 2 December 16th 04 04:33 PM


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