Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Collections problem

How about simply:

If bCondition1 = True Then
Dim coll1 as Collection
Set coll1 = New Collection
End If

If bCondition2 = True Then
Dim coll2 as Collection
Set coll2 = New Collection
End If

etc.

RBS


"John" wrote in message
...
Hi there,

I'm trying to create a variable number (between 1 and 4) of collections,
but I don't know what that number will be in advance. Is there a way of
creating (and declaring) collections at runtime?

So far my solution has been to declare four collections at the beginning
of the code ie

Dim col1 As New Collection
Dim col2 .....

and then setting the unwanted ones to Nothing once the requirement can be
counted, however this seems a bit wasteful.

Any guidance?

Best regards

John


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 205
Default Collections problem

Hi RB,

Yes that would work too. I wasn't aware of the early binding problem, so
will use this, thanks.

Best regards

John

"RB Smissaert" wrote in message
...
How about simply:

If bCondition1 = True Then
Dim coll1 as Collection
Set coll1 = New Collection
End If

If bCondition2 = True Then
Dim coll2 as Collection
Set coll2 = New Collection
End If

etc.

RBS


"John" wrote in message
...
Hi there,

I'm trying to create a variable number (between 1 and 4) of collections,
but I don't know what that number will be in advance. Is there a way of
creating (and declaring) collections at runtime?

So far my solution has been to declare four collections at the beginning
of the code ie

Dim col1 As New Collection
Dim col2 .....

and then setting the unwanted ones to Nothing once the requirement can be
counted, however this seems a bit wasteful.

Any guidance?

Best regards

John




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
Collections problem Jim Thomlinson Excel Programming 1 June 21st 06 06:21 PM
Collections of Collections David Morton Excel Programming 6 November 13th 04 01:10 AM
Problem with Worksheet collections... :( abxy[_62_] Excel Programming 4 May 11th 04 09:18 PM
Help with collections ksnapp[_45_] Excel Programming 1 April 7th 04 12:42 AM
Using Collections Kerry[_4_] Excel Programming 1 January 25th 04 04:08 PM


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