I am trying to add multiple rows to my Excel table (the number to be specified by an inputbox). The rows should go in starting at the current cursor position. I want to add Table rows, not worksheet rows.
My first problem was that I found myself unable to identify the current table row using [#This Row], so have had to resort to using absolute row numbers, subtracting the header row from the current worksheet row to give me the table row number. Using this, I can add a single row at my required location with this line of code:
Code:
Selection.ListObject.ListRows.Add (intCurRow - intHeader)
However, the code simply exits at this point, so I can't use a For...Next or Do...Until loop to add multiple rows.
Is there a way to add multiple table rows with a single command, or to make this code run round a loop?