Search code examples
vbaexcelms-office

VBA Excel check if a particular table exist using table name


I have several tables in an excel sheet. Each having unique table Name. I want to know if a table which has a name "Table123" exist or not in the current sheet.

Could some one help me on this?

Thanks Jeevan


Solution

  • TableExists = False
    On Error GoTo Skip
    If ActiveSheet.ListObjects("Table123").Name = "Table123" Then TableExists = True
    Skip:
        On Error GoTo 0
    

    This code will work and avoid loops and errors