Godders199
Active Member
- Joined
- Mar 2, 2017
- Messages
- 313
- Office Version
- 2013
Hello, i have the following code which runs ( slowly) to pull two reports from an SQL internet database, just seems to run slowly, have had timer on the last few days and it takes between 294 seconds and 684 seconds to complete. my problem is that when i use debug step through it only takes 148 seconds.
Is there a reason why it takes so much longer when left to run from start to finish.
Dim t
t = Timer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Sheets("checksmart").Visible = xlSheetVisible
Sheets("checks").Visible = xlSheetVisible
Sheets("Info").Select
Calculate
Qlink = Sheets("Info").Range("A56").Value
Sheets("checkSmart").Select
Range("A1:AZ50000").Select
Selection.ClearContents
Range("L:L").NumberFormat = "dd/mm/yyyy mm.hh"
Range("u:u").NumberFormat = "dd/mm/yyyy mm.hh"
ActiveWorkbook.XmlImport URL:=Qlink, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A$1")
Sheets("Info").Select
Qlink = Sheets("Info").Range("A69").Value
Sheets("checks").Select
Range("A1:AZ50000").Select
Selection.ClearContents
ActiveWorkbook.XmlImport URL:=Qlink, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A$1")
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Sheets("checksmart").Visible = xlSheetHidden
Sheets("checks").Visible = xlSheethiddden
Sheets("instructions").Select
MsgBox Round(Timer - t, 2) & "sec."
End Sub
Is there a reason why it takes so much longer when left to run from start to finish.
Dim t
t = Timer
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.Calculation = xlCalculationManual
Sheets("checksmart").Visible = xlSheetVisible
Sheets("checks").Visible = xlSheetVisible
Sheets("Info").Select
Calculate
Qlink = Sheets("Info").Range("A56").Value
Sheets("checkSmart").Select
Range("A1:AZ50000").Select
Selection.ClearContents
Range("L:L").NumberFormat = "dd/mm/yyyy mm.hh"
Range("u:u").NumberFormat = "dd/mm/yyyy mm.hh"
ActiveWorkbook.XmlImport URL:=Qlink, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A$1")
Sheets("Info").Select
Qlink = Sheets("Info").Range("A69").Value
Sheets("checks").Select
Range("A1:AZ50000").Select
Selection.ClearContents
ActiveWorkbook.XmlImport URL:=Qlink, ImportMap:=Nothing, Overwrite:=True, Destination:=Range("$A$1")
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.Calculation = xlCalculationAutomatic
Sheets("checksmart").Visible = xlSheetHidden
Sheets("checks").Visible = xlSheethiddden
Sheets("instructions").Select
MsgBox Round(Timer - t, 2) & "sec."
End Sub