Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default delete element is collection

how would i remove all elements from a variable set as new collection?

erase expects an array.

--


Gary



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default delete element is collection

Set your collection to nothing and then re-create it...

Dim col As Collection

Set col = New Collection
col.Add Sheet1, Sheet1.Name
col.Add Sheet2, Sheet2.Name
col.Add Sheet3, Sheet3.Name

MsgBox col.Item(Sheet2.Name).Name
Set col = Nothing
Set col = New Collection

--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

how would i remove all elements from a variable set as new collection?

erase expects an array.

--


Gary




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default delete element is collection


thanks jim, works for me.
--


Gary


"Jim Thomlinson" wrote in message
...
Set your collection to nothing and then re-create it...

Dim col As Collection

Set col = New Collection
col.Add Sheet1, Sheet1.Name
col.Add Sheet2, Sheet2.Name
col.Add Sheet3, Sheet3.Name

MsgBox col.Item(Sheet2.Name).Name
Set col = Nothing
Set col = New Collection

--
HTH...

Jim Thomlinson


"Gary Keramidas" wrote:

how would i remove all elements from a variable set as new collection?

erase expects an array.

--


Gary






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default delete element is collection

Set the collection variable to Nothing. E.g.,

Set MyCollection = Nothing


--
Cordially,
Chip Pearson
Microsoft MVP - Excel, 10 Years
Pearson Software Consulting
www.cpearson.com
(email on the web site)

"Gary Keramidas" <GKeramidasATmsn.com wrote in message
...
how would i remove all elements from a variable set as new collection?

erase expects an array.

--


Gary




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
Delete worksheet in collection Stu W Excel Programming 4 June 26th 07 10:34 PM
VBA- Contains any element digiphotogirl Excel Programming 1 March 11th 05 10:41 PM
Delete String Element John[_88_] Excel Programming 3 February 8th 05 08:26 PM
Delete rows with common element Anauna Excel Programming 3 December 21st 04 04:19 PM


All times are GMT +1. The time now is 09:12 PM.

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"