Hi,
I am trying to create a list of all tables in a workbook and I am also trying to create an userform with one or more list boxes with the table names in them.
The listbox is called listbox1, listbox2 and listbox3.
This code debug prints the information I am looking for and I want to print it to a worksheet?
I am trying to create a list of all tables in a workbook and I am also trying to create an userform with one or more list boxes with the table names in them.
The listbox is called listbox1, listbox2 and listbox3.
Code:
Sub tableAllSheet()
Dim sh As Worksheet
Dim tbl As ListObject
'Loop through all sheets
For Each sh In ThisWorkbook.Worksheets
'Loop through all table on a sheet
For Each tbl In sh.ListObjects
'Print table name, table header row address and data range address to Immediate window
Debug.Print tbl.Name & vbTab & tbl.HeaderRowRange.Address & vbTab & tbl.DataBodyRange.Address
Next tbl
Next sh
End Sub
This code debug prints the information I am looking for and I want to print it to a worksheet?