Afro_Cookie
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 103
- Office Version
- 365
- Platform
- Windows
We use a macro daily to update some of our production files and when we run the macro, it only works on some computers. We've been using the same computer to run this and other queries for over a year and until this month, we have not had any issues. I can't determine why one computer would be able to run the macro while another cannot.
Below is the code and when I run the code line by line, it stops at tbl.Copy Workbooks("report").Sheets("Sort").Range("A1"). Any help possible would be greatly appreciated.
Below is the code and when I run the code line by line, it stops at tbl.Copy Workbooks("report").Sheets("Sort").Range("A1"). Any help possible would be greatly appreciated.
VBA Code:
Sub gather_information()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Workbooks.Open "source file"
Dim tbl As Range
Set tbl = Sheets("main").AutoFilter.Range
Set tbl = tbl.Resize(tbl.Rows.Count - 1)
Set tbl = tbl.Offset(1)
Sheets("main").Select
ActiveSheet.Range("$A$1:$J$1").AutoFilter Field:=1, Operator:=xlFilterValues, Criteria2:=Array(2, Date)
tbl.Copy Workbooks("report").Sheets("Sort").Range("A1")
Workbooks("source file").Close SaveChanges:=False
End Sub