captainxcel
New Member
- Joined
- Jul 28, 2017
- Messages
- 35
- Office Version
- 2016
- Platform
- Windows
Hello and Thanks in advance. I use the following code to add one or more rows to all tables in a worksheet (the background is that I have a worksheet with over 100 tables that needs a 1 for 1 row count correspondence with another table). How would I modify the code in order to delete one or more rows from all tables in the worksheet?
Thanks
Thanks
VBA Code:
Sub addSomeRowsToAllTablesOnSheet()
Dim tbl As ListObject
Dim NewRow As ListRow
Dim i As Integer
Dim new_rows As Integer
new_rows = InputBox("How many row(s) would you like to add to each table:", 1)
For i = 1 To new_rows
For Each tbl In Worksheets("Test").ListObjects
Set NewRow = tbl.ListRows.Add
Next tbl
Next i
End Sub