I'm looking for a smarter way to run a macro that copies elements of a filtered list to a table.
The loop currently runs to the defined end column (70) however the actual last populated cell could be in column 30, but it continues to loop though the empty cells.
I'd like it to stop looping through once it finds the last value in that particular row. I did try End(xlToLeftRight) but not sure of the syntax.
The relevant code is:
10: ActiveCell.Offset(1, 0).Select
Do Until ActiveCell.EntireRow.Hidden = False
ActiveCell.Offset(1, 0).Select
Loop
Sheets("By Team").ListObjects("byteam").ListRows.Add AlwaysInsert:=True
ActiveWorkbook.Sheets("By Team").Cells(i, 1).Value = ActiveCell.Offset(0, -7).Value
ActiveWorkbook.Sheets("By Team").Cells(i, 2).Value = ActiveCell.Offset(0, -6).Value
ActiveWorkbook.Sheets("By Team").Cells(i, 4).Value = ActiveCell.Offset(0, -5).Value
ActiveWorkbook.Sheets("By Team").Cells(i, 3).Value = ActiveCell.Offset(0, 0).Value
x = 5
For j = 5 To 70
ActiveWorkbook.Sheets("By Team").Cells(i, j).Value = ActiveCell.Offset(0, x).Value
x = x + 1
Next
i = i + 1
If ActiveCell.Value <> "" Then GoTo 10
The line I'm interested in is
Can someone point me in the right direction please?
Bookmarks