laguna92651
Programmer
I am adding multiple records at one time to a table from a another worksheet with code. Even though the records are added to the bottom of the table they do not seem to be part of the table structure. Any formulas that are part of the table are not implemented in the new records. If I have a pivot table already created before adding the new records, and do a refresh of the pivot table the new records are not reflected in the refreshed results. If I add the pivot table after the new records are added, the pivot table totals are correct. Any ideas on how can include the new records in the table, table6.
Code:
Sub MoveRecord()
Dim Increment As Integer 'looping variable
Dim WSF As Worksheet ' Invoice worksheet
Dim WSD As Worksheet ' SalesData worksheet
Set WSF = Worksheets("Invoice")
Set WSD = Worksheets("SalesData")
NextRow = WSD.Cells(Rows.Count, 2).End(xlUp).Row + 1
For Increment = 19 To 34
If WSF.Cells(Increment, 3) <> "" Then
WSD.Cells(NextRow, 1).Resize(1, 14).Value = Array([D4], [F4], [F4], [F3], [A16], [B16], [c9],
Cells(Increment, 3), Cells(Increment, 4), Cells(Increment, 11), Cells(Increment, 2),
Cells(Increment, 12), Cells(Increment, 13), Cells(Increment, 14))
NextRow = WSD.Cells(Rows.Count, 2).End(xlUp).Row + 1
End If
Next Increment
End Sub