I've put together the below function to loop through three specific worksheets in a workbook and delete the table contents for tables in each worksheet.
I get
'Runtime Error 9, subscript out of range'
When I debug
For Each tbl In Sheets(Sht).ListObjects
is highlighted.
Sub ClearTableData()
Application.ScreenUpdating = False
Dim tbl As ListObject
Dim Sht As Variant
'Loop through each sheet and table in the workbook
For Each Sht In Array("Sheet1", "Sheet2", "Sheet3")
For Each tbl In Sheets(Sht).ListObjects
'Delete table rows
tbl.DataBodyRange.Delete
Next tbl
Next Sht
Application.ScreenUpdating = True
End Sub