delete element is collection

  • Thread starter Thread starter Gary Keramidas
  • Start date Start date
G

Gary Keramidas

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

erase expects an array.
 
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
 
thanks jim, works for me.
--


Gary


Jim Thomlinson said:
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
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top