Sub TestIfActiveCellIsInTable()Dim ActiveCellInTable As BooleanDim ACell As Range'Set a reference to the ActiveCell named ACell. You can always use'ACell now to point to this cell, no matter where you are in the workbook.
Set ACell = ActiveCell
'Test whether ACell is in a table.On Error Resume NextActiveCellInTable = (ACell.ListObject.Name <> "")On Error GoTo 0If ActiveCellInTable = True ThenMsgBox "The ActiveCell is a part of a table."ElseMsgBox "The ActiveCell is not a part of a table."End IfEnd SubReference:Tags: VBA, Excel, cell, check, table, list