ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   maximum number of members in a collection (https://www.excelbanter.com/excel-programming/368773-maximum-number-members-collection.html)

excel_ez

maximum number of members in a collection
 
Hi

I tried to create an Excell2003 VB collection with say 1500-2000 members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too low.

I was just wondering if any of you knows more about this?

RB Smissaert

maximum number of members in a collection
 
Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000 members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too low.

I was just wondering if any of you knows more about this?



excel_ez[_2_]

maximum number of members in a collection
 
This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000 members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too low.

I was just wondering if any of you knows more about this?




Tom Ogilvy

maximum number of members in a collection
 
Sub abc()
Dim myCollection As Collection
Dim member As Range

Dim i As Long

Set myCollection = New Collection

For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollection.Add member
Next
Debug.Print myCollection.Count
Debug.Print myCollection.Item(myCollection.Count).Address
End Sub


Returned:

3000
$A$3000:$N$3000

for me.

--
Regards,
Tom Ogilvy

"excel_ez" wrote in message
...
This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000
members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too
low.

I was just wondering if any of you knows more about this?






Greg Wilson

maximum number of members in a collection
 
Your problem appears to originate from clsMembers. This worked for me:

Public i As Long
Sub x()
Dim myCollection As Collection
Dim member As Range 'clsMembers
Set myCollection = New Collection
For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollection.Add member
Next
'Now test collection
For i = 500 To 3000 Step 500
MsgBox myCollection(i).Address
Next
End Sub

Regards,
Greg

"excel_ez" wrote:

This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000 members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too low.

I was just wondering if any of you knows more about this?




RB Smissaert

maximum number of members in a collection
 
What is the code of clsMembers?

RBS

"excel_ez" wrote in message
...
This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000
members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too
low.

I was just wondering if any of you knows more about this?





excel_ez[_2_]

maximum number of members in a collection
 
the clsMembers looks like this:

Option Explicit

Public Artist As String
Public Album As String
Public Name As String
Public PlayCount As Integer
Public Genre As String
Public Size As Long
Public Time As Long
Public Year As Integer
Public TrackNumber As Integer
Public BitRate As Integer
Public LastPlayed As String
Public DateAdded As String
Public Rating As Integer
Public CheckSum As Single

Thanks a lot

"RB Smissaert" wrote:

What is the code of clsMembers?

RBS

"excel_ez" wrote in message
...
This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000
members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too
low.

I was just wondering if any of you knows more about this?





excel_ez[_2_]

maximum number of members in a collection
 
Well

It works.

The thing is that I was looking at the collection in watch window and there
it lists only 256 members. However the whole collection is there and the
members can be accessed.

My mistake, I shouldn't have trusted the Watches :-|

Thanks to all of you


"excel_ez" wrote:

Hi

I tried to create an Excell2003 VB collection with say 1500-2000 members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too low.

I was just wondering if any of you knows more about this?


Peter T

maximum number of members in a collection
 
Just curiosity, why do you need a collection vs simply

Dim rng As Range
Set rng = Range(Cells(1, 1), Cells(3000, 14))
Debug.Print rng.Rows(rng.Rows.Count).Address

Regards,
Peter T


"excel_ez" wrote in message
...
This is just a part of my original code:

Dim myCollection As New Collection
Dim member As clsMembers

Public i As Long


For i = 1 To 3000
Set member = Range(Cells(i, 1), Cells(i, 14))
myCollections.Add member
next

I am trying to create a collection of row within a range. I tried the same
mechanism with simple elements like numbers etc. but I never got past 256

"RB Smissaert" wrote:

Didn't you have a Byte variable anywhere causing the trouble?
Post the code.

RBS

"excel_ez" wrote in message
...
Hi

I tried to create an Excell2003 VB collection with say 1500-2000

members.
But after 256 members are added, the loop continues WITHOUT ANY ERROR
MESSAGE
but no more members are added to the collection

Is it possible that 256 is the limit?

I couldn't find it written down anywhere, but that limit is just too

low.

I was just wondering if any of you knows more about this?







All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com