Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Clearing all items in a collection

Hey guys

Below is an example of how I created my collection
called "testCollection".

Dim TestCollection As New Collection

I have a code that loops through a range and adds items to
this collection. How do I clear all items in the
collection?


Thanks
Todd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Clearing all items in a collection

Hi Todd
you as a quite regular poster should know not to multipost :-)


--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine" schrieb im
Newsbeitrag ...
Hey guys

Below is an example of how I created my collection
called "testCollection".

Dim TestCollection As New Collection

I have a code that loops through a range and adds items to
this collection. How do I clear all items in the
collection?


Thanks
Todd


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Clearing all items in a collection

I didnt multipost. Why do you say I multipost?


-----Original Message-----
Hi Todd
you as a quite regular poster should know not to

multipost :-)


--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine"

schrieb im
Newsbeitrag ...
Hey guys

Below is an example of how I created my collection
called "testCollection".

Dim TestCollection As New Collection

I have a code that loops through a range and adds items

to
this collection. How do I clear all items in the
collection?


Thanks
Todd


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Clearing all items in a collection

Hi Todd
the same question from you appeared in public.excel.misc :-)

--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine" schrieb im
Newsbeitrag ...
I didnt multipost. Why do you say I multipost?


-----Original Message-----
Hi Todd
you as a quite regular poster should know not to

multipost :-)


--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine"

schrieb im
Newsbeitrag ...
Hey guys

Below is an example of how I created my collection
called "testCollection".

Dim TestCollection As New Collection

I have a code that loops through a range and adds items

to
this collection. How do I clear all items in the
collection?


Thanks
Todd


.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 260
Default Clearing all items in a collection

Oh I wondered why my messages were not showing up. I am
at work and when Im at work I have to access the newsgroup
through Microsoft.com. THe default newsgroup it goes to
first is General Questions which is apparently the misc
group you are talking about. I see 2 of the same posts in
there. Sorry I did not intend for them to go to the
misc. I never use that group anyway.


Thanks. I figured out what was going on with my code. I
found out that in order to remove items from a collection,
you must use the .remove method. I was saying .remove
(variable) and it was not working. It kept leaving 1 item
in there. When you remove an item in a collection, the
index resets to 1. I did not know this, so instead I
used .remove 1 and then it worked.


Tod Huttenstine



-----Original Message-----
Hi Todd
the same question from you appeared in

public.excel.misc :-)

--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine"

schrieb im
Newsbeitrag ...
I didnt multipost. Why do you say I multipost?


-----Original Message-----
Hi Todd
you as a quite regular poster should know not to

multipost :-)


--
Regards
Frank Kabel
Frankfurt, Germany

"Todd Huttenstine"


schrieb im
Newsbeitrag news:5bf901c48160$55af4590

...
Hey guys

Below is an example of how I created my collection
called "testCollection".

Dim TestCollection As New Collection

I have a code that loops through a range and adds

items
to
this collection. How do I clear all items in the
collection?


Thanks
Todd


.


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Clearing all items in a collection

Hi Todd,

Todd Huttenstine wrote:
Thanks. I figured out what was going on with my code. I
found out that in order to remove items from a collection,
you must use the .remove method. I was saying .remove
(variable) and it was not working. It kept leaving 1 item
in there. When you remove an item in a collection, the
index resets to 1. I did not know this, so instead I
used .remove 1 and then it worked.


Another option is to destroy the collection (Set TestCollection=Nothing).
I've found it to faster, not to mention less code.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]

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
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
How do I find clearing items in a column in Excel? DACLEMEN Excel Discussion (Misc queries) 4 September 8th 08 09:44 PM
Adding Unique Items to a Collection WJ Excel Discussion (Misc queries) 2 June 12th 07 03:46 PM
How do I find clearing items in a column in Excel? DACLEMEN Excel Worksheet Functions 1 June 28th 06 03:11 PM
Problem with assigning values to items in collection Jurry[_12_] Excel Programming 0 May 12th 04 09:18 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"