Author: Oscar Cronquist Article last updated on January 09, 2018

This macro creates a new sheet and lists all tables and corresponding table headers in a workbook.

Sub ListTables()
Dim tbl As ListObject
Dim WS As Worksheet
Dim i, j As Single
Set WS = Sheets.Add
i = 1
For Each WS In Worksheets
    For Each tbl In WS.ListObjects
        Range("A1").Cells(i, 1).Value = tbl.Name
        For j = 1 To tbl.Range.Columns.Count
            Range("A1").Cells(i, j + 1).Value = tbl.Range.Cells(1, j)
        Next j
        i = i + 1
    Next tbl
Next WS
End Sub


Sheet1, 2 and 3 contain three tables.

Run macro

  1. Go to "Developer" tab
  2. Click "Macros" button
  3. Click "ListTables"
  4. Click "Run"

Create macro

Open VB Editor, shortcut keys: Alt + F11.

Download excel 2007 macroenabled *.xlsm file

List all tables and headers in a workbook.xlsm