I have the following code which appears to get stuck after I open a new workbook (EMEA). I would like to be able to filter the first workbook which is already open (data), and copy and paste between the two. As soon as I open the new workbook, I cannot navigate back to the data workbook and the code doesn't run as it should. When I step through the code to debug it, it works normally which is weird (although I have to manually click back to the data workbook first). I'm calling Sub copy() from another sub command if that makes a difference and the macro is saved in PERSONAL.XLSB
Public wb As Workbook Public sPath As String Public LR As Long Sub copy() today = Format(Date, "mm-dd-yyyy") sPath = "S:\[I]XXXXX\EMEA[/I].xlsx" Set wb = Workbooks.Open(sPath) Windows("Data (" & today & ").xlsx").Activate ActiveSheet.ShowAllData ActiveSheet.Range("$A$1:$CU$20000").AutoFilter Field:=4, Criteria1:="EMEA" LR = Range("A" & Rows.Count).End(xlUp).Row Range("D2:D" & LR).Select Selection.Copy Windows("EMEA.xlsx").Activate Range("A3").Select ActiveSheet.Paste [\code] Thanks in advance!