Hi,
The following code works to define ranges in 200 plus tabs in a workbook but it names each table Table1, 2, 3, and so on.
can any one revise the code to provide the worksheet name as table name instead please?
Thank you
The following code works to define ranges in 200 plus tabs in a workbook but it names each table Table1, 2, 3, and so on.
can any one revise the code to provide the worksheet name as table name instead please?
Thank you
Code:
Sub AddTablesIfNone()
Dim ws As Excel.Worksheet
For Each ws In ActiveWorkbook.Worksheets
With ws
If .UsedRange.ListObject Is Nothing Then
.ListObjects.Add SourceType:=xlSrcRange, Source:=.UsedRange, xllistobjecthasHeaders:=xlYes
End If
End With
Next ws
End Sub
>>> use code - tags <<<
Attachments
Last edited by a moderator: