Why is it that you can do this:
Dim lo as ListObject
Set lo = ActiveCell.ListObject
If lo Is Nothing Then ‘Do something
Set lo = ActiveCell.ListObject
If lo Is Nothing Then ‘Do something
…but you can’t do this:
Dim pt as PivotTable
Set pt = ActiveCell.PivotTable
If pt Is Nothing Then ‘Do something
Set pt = ActiveCell.PivotTable
If pt Is Nothing Then ‘Do something
…and instead you have to do this:
Dim pt as PivotTable
On Error Resume Next
Set pt = ActiveCell.PivotTable
If Err.Number > 0 then ‘Do something
Err.clear
On Error Resume Next
Set pt = ActiveCell.PivotTable
If Err.Number > 0 then ‘Do something
Err.clear
Huh? Huh?