Deletes a query table

30/06/2015 § Leave a comment

Sub Clear_QueryTable()

Dim qt As QueryTable
For Each qt In ActiveSheet.QueryTables
If qt.Refreshing Then qt.CancelRefresh
qt.Delete
Next
ActiveSheet.UsedRange.Clear

End Sub

_________
Source
https://www.safaribooksonline.com/library/view/programming-excel-with/0596007663/re661.html

Synopsis

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:

Advertisements

Tagged: ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading Deletes a query table at RheXenoR.

meta

%d bloggers like this: