Name
querytable
.Destination
Synopsis
Returns a Range
object containing the cell in the upper-lefthand corner of the query table.
The following code selects the first cell of a query table on the active worksheet and asks if the user wants to delete it:
For Each qt In ActiveSheet.QueryTables qt.Destination.Select If MsgBox("Delete query table?", vbYesNo) = vbYes Then If qt.Refreshing Then qt.CancelRefresh qt.ResultRange.Clear qt.Delete End If Next
Get Programming Excel with VBA and .NET now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.