Hello. I'm looking for a method to add multiple new rows into a protected table at the same time. I have thisBut I'd rather do it as a single row insert, rather than using the for-next loop. Looping takes too long if I insert many rows, because there's additional code that populates the inserted new rows. Is there a way to insert multiple new rows with only 1 line of code? Any suggestions please?![]()
Dim oList As ListObject ' list variable for the Reference Database Dim RefTabHeader ' 2-dimensional array for the database header Private Sub UserForm_Initialize() Set oList = ActiveCell.ListObject ' set oList to Reference Database RefTabHeader = oList.HeaderRowRange.Value ' populate 2-dimensional array with database header End Sub Private Sub FillInRows(bCopy As Boolean) Dim oRow As ListRow Dim i As Long Application.ScreenUpdating = False For i = 1 To CInt(Me.tbNumRows) Set oRow = oList.ListRows.Add(ActiveCell.Row - oList.Range.Row + 1) Next i End Sub
Bookmarks