Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default ITERATING THROUGH WORKSHEETS ! !

Hi - Two questions:

1. I am looping through worksheets in a workbook. However, I do not want
to loop through any sheets that contain the color yellow (i.e,
colorindex 6)in any cell. The sheets many and any help would be
appreciated.

2. Also, if there are say about 25 sheets in a workbook labeled in order
from "SheetA", "SheetB", "SheetC".....though "SheetY", how do I loop
through ONLY from say "SheetN" through "SheetY" without using "if
sht.name<"..." OR "if sht.name="..." so many times?

Thanks
Jay


*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 364
Default ITERATING THROUGH WORKSHEETS ! !

here's one way if they're in order

Sub test()
Dim i As Long
For i = 13 To 25
Worksheets(i).Activate
Next
End Sub

--


Gary

"jay dean" wrote in message
...
Hi - Two questions:

1. I am looping through worksheets in a workbook. However, I do not want
to loop through any sheets that contain the color yellow (i.e,
colorindex 6)in any cell. The sheets many and any help would be
appreciated.

2. Also, if there are say about 25 sheets in a workbook labeled in order
from "SheetA", "SheetB", "SheetC".....though "SheetY", how do I loop
through ONLY from say "SheetN" through "SheetY" without using "if
sht.name<"..." OR "if sht.name="..." so many times?

Thanks
Jay


*** Sent via Developersdex http://www.developersdex.com ***


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default ITERATING THROUGH WORKSHEETS ! !

Thanks, Gary. This works fine !!

Jay

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default ITERATING THROUGH WORKSHEETS ! !

question 1

Sub countcolorinsheet()
For Each ws In Worksheets
counter = 0
For Each c In ws.UsedRange
If c.Interior.ColorIndex = 6 Then
counter = counter + 1
Exit For
Else
End If
Next c
If counter < 1 Then
MsgBox ws.Name
End If
Next ws
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jay dean" wrote in message
...
Hi - Two questions:

1. I am looping through worksheets in a workbook. However, I do not want
to loop through any sheets that contain the color yellow (i.e,
colorindex 6)in any cell. The sheets many and any help would be
appreciated.

2. Also, if there are say about 25 sheets in a workbook labeled in order
from "SheetA", "SheetB", "SheetC".....though "SheetY", how do I loop
through ONLY from say "SheetN" through "SheetY" without using "if
sht.name<"..." OR "if sht.name="..." so many times?

Thanks
Jay


*** Sent via Developersdex
http://www.developersdex.com ***

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 154
Default ITERATING THROUGH WORKSHEETS ! !

Thank you Don, and Gary !

Jay


*** Sent via Developersdex http://www.developersdex.com ***
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
iterating through worksheets SteveDB1 Excel Programming 8 January 13th 09 01:28 PM
Iterating through a collection (For Each) Memento Excel Programming 8 June 4th 07 12:53 PM
iterating groups? Mike[_98_] Excel Programming 1 September 21st 05 11:11 AM
iterating checkboxes [email protected] Excel Discussion (Misc queries) 1 May 11th 05 08:42 PM
Iterating Thru Cells Kelvin Clayson Excel Programming 6 November 9th 04 06:33 PM


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