Can you help me please with the following problem? I have a code which opens an excel file in a certain locations and makes a filter in it, but after this I can't select the range I need:
Private Sub CommandButton1_Click()
'dim Wb as string
'dim Newdata as string
Newdata = "M:\Finance\REPORTING\2022_08\Hóközi FC\GL.xlsx"
Set Wb = Workbooks.Open(Newdata)
ThisWorkbook.RefreshAll
ActiveSheet.Range("A:AE").AutoFilter Field:=30, Criteria1:="P2"
Windows("GL.xlsx").Activate
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
End Sub
Thanks in advance