Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Reset New Collection

Created a collection and will need to reset it to zero
once it has been compiled so that it can be compiled with
other data.

Dim cTraders As New Collection

On Error Resume Next
For Each rCell In Range(Cells(65536, 1).End(xlUp), Cells
(2, 1))
cTraders.Add rCell.Value, rCell.Value
Next rCell
On Error GoTo 0

I need a line here to reset the collection to zero so that
when i move on the next worksheet the collection will be
different. Thanks!!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Reset New Collection

Tony,

Set the collection to Nothing. E.g.,

Set cTraders = Nothing


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

"Tony Di Stasi" wrote in message
...
Created a collection and will need to reset it to zero
once it has been compiled so that it can be compiled with
other data.

Dim cTraders As New Collection

On Error Resume Next
For Each rCell In Range(Cells(65536, 1).End(xlUp), Cells
(2, 1))
cTraders.Add rCell.Value, rCell.Value
Next rCell
On Error GoTo 0

I need a line here to reset the collection to zero so that
when i move on the next worksheet the collection will be
different. Thanks!!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Reset New Collection

Sub AAA()

Dim cTraders As New Collection

On Error Resume Next
For Each rCell In Range(Cells(65536, 1).End(xlUp), Cells(2, 1))
cTraders.Add rCell.Value, rCell.Value
Next rCell
On Error GoTo 0
Debug.Print cTraders.Count
For i = 1 To cTraders.Count
cTraders.Remove cTraders.Item(1)
Next
Debug.Print cTraders.Count
End Sub

--
Regards,
Tom Ogilvy


"Tony Di Stasi" wrote in message
...
Created a collection and will need to reset it to zero
once it has been compiled so that it can be compiled with
other data.

Dim cTraders As New Collection

On Error Resume Next
For Each rCell In Range(Cells(65536, 1).End(xlUp), Cells
(2, 1))
cTraders.Add rCell.Value, rCell.Value
Next rCell
On Error GoTo 0

I need a line here to reset the collection to zero so that
when i move on the next worksheet the collection will be
different. Thanks!!



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
Does anybody have a CD collection template PeterM Excel Discussion (Misc queries) 2 November 27th 04 05:46 PM
sheet collection Tom Ogilvy Excel Programming 0 October 28th 03 03:15 PM
Is a Collection the best option? Stuart[_5_] Excel Programming 5 August 31st 03 09:51 PM
Is a Collection the best option? Bradley Dawson Excel Programming 1 August 31st 03 08:14 PM
Sum textboxes in a collection Mark[_18_] Excel Programming 1 August 28th 03 04:17 AM


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