April 2006
Beginner
1114 pages
98h 16m
English
querytable.Delete
Deletes a query table. If the query table is refreshing asynchronously, Delete causes an error. Deleting a query table does not remove data from cells on a worksheet—it just removes the ability to refresh those cells from their data source.
The following code deletes all of the query tables on the active worksheet and clears their data:
Dim qt As QueryTable
For Each qt In ActiveSheet.QueryTables
If qt.Refreshing Then qt.CancelRefresh
qt.Delete
Next
ActiveSheet.UsedRange.ClearRead now
Unlock full access