I am trying to add rows to a table on one worksheet with data from a different sheet. The below code is working to an extent.
I am able to have it add in one row of data at a time, as well as determine where the data is added to the table. However, I would like it to add in multiple rows of data, while still being able to determine where in the table it will be added.
I've tried different variations of achieving this process, however, they all seem to have an issue. Either I can insert multiple rows, but can't determine where in the table they go, or I haven't been able to add multiple rows at one time.
Sub AddData()
Dim ws As Worksheet
Dim tbl As ListObject
Dim NewRow As ListRow
Set ws = ActiveWorkbook.Worksheets("DATA Member-19")
Set tbl = ws.ListObjects("MemberInfo19")
Set NewRow = tbl.ListRows.Add
With NewRow
.Range(1) = Sheets("Add Members").Range("B4")
End With
End Sub
The range for the new row would start at B4 and would change depending on how much data needs to be added. It could be only one row, but it could also be several rows of data that needs to be transferred over.