LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Reference to Item in Collection

I want to cycle through a collection and add members on the basis of whether
they exist. For example:

Function Test(Optional M1, Optional M2, Optional M3)
Dim Group as New Collection

With Group
If Not IsMissing(M1) then .Add M1
If Not IsMissing(M1) then .Add M1
If Not IsMissing(M1) then .Add M1
end with
.. . .
End Function

Is it possible to build a reference such that I could use a loop:

For i=1 to 10
If Not IsMissing("M" & i) then Group.Add "M" & i
next i

Is there a function that would tell VBA to recognize the string as a
variable (or object, etc.)? This is quite simple to do in SAS.

Thanks,

Chad



 
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
Cannot remove item from collection Kou Vang[_2_] Excel Programming 1 January 31st 06 08:24 PM
Collection Object, 255 item limitation timothy[_2_] Excel Programming 4 September 11th 05 09:43 PM
Retrieving a Collection Item Todd Huttenstine Excel Programming 2 October 27th 04 07:15 PM
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 09:46 AM.

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"