I'm having a little issue with the following VBA code interfering with my hidden row(s)
Sub macAddRow()
Dim loTbl As ListObject
Set loTbl = ActiveSheet.ListObjects("Table1")
loTbl.ListRows.Add
End Sub
Here's the problem. Let's say Table1 takes up the space A1:D5. I have data in cells in rows 9, 10, and 11. Row 10 is hidden. When I execute the code, my data in rows 9, 10, and 11 shifts down to rows 10, 11, and 12, but row 10 is still the hidden row. I want it to be row 11 that is hidden. Hopefully the attached before & after code execution images make this problem clear.
I will eventually have multiple tables in this worksheet, and the number of rows in each table will be frequently changing. There will be multiple hidden rows. Is there a small tweak I can make to the code in order for it to work the way I want? Please let me know if there's something you want me to clarify.
Sub macAddRow()
Dim loTbl As ListObject
Set loTbl = ActiveSheet.ListObjects("Table1")
loTbl.ListRows.Add
End Sub
Here's the problem. Let's say Table1 takes up the space A1:D5. I have data in cells in rows 9, 10, and 11. Row 10 is hidden. When I execute the code, my data in rows 9, 10, and 11 shifts down to rows 10, 11, and 12, but row 10 is still the hidden row. I want it to be row 11 that is hidden. Hopefully the attached before & after code execution images make this problem clear.
I will eventually have multiple tables in this worksheet, and the number of rows in each table will be frequently changing. There will be multiple hidden rows. Is there a small tweak I can make to the code in order for it to work the way I want? Please let me know if there's something you want me to clarify.