Adding additional rows to table
The following code adds an additional row after each odd row
Code:
Sub Tbl_Add_Rows()
'In the selected tbl, insert a row after each odd row.
Dim LastRow As Integer
Application.ScreenUpdating = False
LastRow = selection.Tables(1).rows.count
If LastRow Mod 2 = 0 Then
LastRow = LastRow
Else: LastRow = LastRow - 1
End If
For i = LastRow To 2 Step -2
selection.Tables(1).rows(i).Select
With selection.Tables(1).rows(i)
selection.InsertRowsAbove 1
End With
Next i
Application.ScreenUpdating = True
End Sub
I'm assuming then that if one knows the "pattern" of when you would like a row inserted you need to adapt either Mod(?) or For i = LastRow to 2 step(?) or both to adjust the insertion point. Is this correct?