Collection methods

  • Thread starter Christopher Benson-Manica
  • Start date
C

Christopher Benson-Manica

How do I delete all the elements in a collection? (Specifically, the
QueryTables collection, but I don't know if that matters).

You'd think this would be trivial, but Excel's VBA help is a horrific
unmitigated disaster.
 
B

Bob Phillips

N ever used QueryTables, but to clear from a collection you would normally
use

For Each ws in Activeworkbook
For Each qyt In ws.QueryTables
qyt.Delete
Next qty
Next ws

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
C

Christopher Benson-Manica

Bob Phillips said:
For Each ws in Activeworkbook
For Each qyt In ws.QueryTables
qyt.Delete

I see. Now, if Excel's help could have told me that... I know now
that collections have a Count property, but where could I have found
that information, say, on MSDN or the VBA help...?
 

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

Top