Skip to content
Rodrigo Celso de Lima Porto edited this page Jan 14, 2026 · 2 revisions

Checks if a ListObject (Excel table) has an associated QueryTable.

Syntax

TableHasQuery( _
    tbl As ListObject _
) As Boolean

Parameters

  • tbl: The ListObject (table) to check.

Return Value

Returns True if the table has an associated QueryTable; otherwise returns False. If tbl is Nothing, the function returns False.

Example

Dim tbl As ListObject
Dim hasQuery As Boolean

Set tbl = ThisWorkbook.Worksheets("Sheet1").ListObjects("Table1")
hasQuery = TableHasQuery(tbl)

If hasQuery Then
    Debug.Print "Table has a QueryTable"
Else
    Debug.Print "Table does not have a QueryTable"
End If

Clone this wiki locally