LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Rob Rob is offline
external usenet poster
 
Posts: 718
Default Check for an item in a collection (without looping)

Let's say I have sheets 1 to 10, and I add some of those sheets to a
collection. I want to be able to test whether a given sheet (say sheet8) is
a member of that collection. I know I could test each item in the collection
using a loop, but I want to avoid that if posible. Any help??

set SheetsCollection = sheets(Array("Sheet1", "Sheet7", "Sheet4"))

For each sht in Activeworkbook.sheets
' If sht is in SheetsCollection then
msgbox "Sheet found in collection"
' else
msgbox "Sheet not Found in collection"
' end if
Next

 
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
Using a Check Box as a control item Dan G Excel Discussion (Misc queries) 2 December 14th 04 07:59 PM
Retrieving a Collection Item Todd Huttenstine Excel Programming 2 October 27th 04 07:15 PM
Deleting named ranges by looping through range collection agarwaldvk[_11_] Excel Programming 3 August 3rd 04 01:00 AM
Add Unique item to Collection Dick Kusleika[_3_] Excel Programming 8 January 21st 04 08:59 PM
Removing an Item From a Collection Dan Gesshel Excel Programming 4 November 1st 03 01:12 PM


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