First, the following code runs to distribute data from from an upload to several different worksheets, all of which contain tables.
This does a great job of adding the new data to each worksheet right below the last line of the table. However, I want to incorporate some code to resize the tables on each worksheet to include the latest data rows. Some tables have more lines than others. The code I have works on the very first worksheet but fails to loop through the rest of my worksheets. Here is that code:
Any help is greatly appreciated!!!!! Thank you!
VBA Code:
Sub Dispatch()
rng = shtWF.cells(1, 1).CurrentRegion
On Error Resume Next
For rw = 1 To UBound(rng)
rRng = Right(rng(rw, 6), 4)
Sheets(rRng).cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Resize(1, UBound(rng)).Value = shtWF.cells(rw, 1).Resize(1, UBound(rng)).Value
Next rw
On Error GoTo 0
End Sub
This does a great job of adding the new data to each worksheet right below the last line of the table. However, I want to incorporate some code to resize the tables on each worksheet to include the latest data rows. Some tables have more lines than others. The code I have works on the very first worksheet but fails to loop through the rest of my worksheets. Here is that code:
VBA Code:
Sub ResizeTbls()
Dim tbl As ListObject
Dim lrw As Long
Dim ws As Worksheet
lrw = ActiveSheet.cells(Rows.Count, "A").End(xlUp).Row
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
For Each tbl In ActiveSheet.ListObjects
tbl.Resize Range("A3", "T" & lrw)
Next
Next
Application.ScreenUpdating = True
End Sub
Any help is greatly appreciated!!!!! Thank you!