K
ker_01
I'm looping through code that updates an autofilter, and then I copy the
autofiltered data to a target sheet (hundreds of times). The problem is that
it is also copying the header row, and as I add each chunk of data to my
destination sheets, I've got unwanted repeating header rows throughout the
data.
Is there a good way to select the autofiltered rows while excluding just the
header row? When I record my desired activity via macro, is selects the first
row, which will vary depending on what data I'm autofiltering on in each loop.
Current code:
Sheet2.Activate
Sheet2.Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=SortableTempVal
Sheet2.Cells.Select
Selection.Copy
Recorded macro selecting the visible rows excluding the header row:
Rows("752:752").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
If there isn't a good way, I suppose I can write some less elegant code to
delete the first pasted row in each destination worksheet, but I was hoping
to learn something new today
Thanks!
Keith
autofiltered data to a target sheet (hundreds of times). The problem is that
it is also copying the header row, and as I add each chunk of data to my
destination sheets, I've got unwanted repeating header rows throughout the
data.
Is there a good way to select the autofiltered rows while excluding just the
header row? When I record my desired activity via macro, is selects the first
row, which will vary depending on what data I'm autofiltering on in each loop.
Current code:
Sheet2.Activate
Sheet2.Cells.Select
Selection.AutoFilter
Selection.AutoFilter Field:=2, Criteria1:=SortableTempVal
Sheet2.Cells.Select
Selection.Copy
Recorded macro selecting the visible rows excluding the header row:
Rows("752:752").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
If there isn't a good way, I suppose I can write some less elegant code to
delete the first pasted row in each destination worksheet, but I was hoping
to learn something new today
Thanks!
Keith