I need to create a macro to make a filter, copy the result of that filter from the 2nd line and paste it into another sheet. I've tried everything (offset, usedrange, sendkeys) but nothing worked. I need it to be variable because the range position will change whenever I update the base with new information. This is the last code I tried:
ActiveSheet.ShowAllData
ActiveSheet.Range("$A$1:$U$419655").AutoFilter Field:=18, Criteria1:="1"
ActiveSheet.UsedRange.Offset(1, 0).Select
Selection.Copy
Sheets("HEX Acima").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks \_
:=False, Transpose:=False```


ActiveSheet.ShowAllDataraises error1004if there isn't filtering on sheet. UseIfclauses to avoid the error.CurrentRegionproperty to capture the data table if it is acontiguousrange.Microsoft documentation: