Macro runs slowly only on new laptop

M

Matthieu

I have a macro that is linking to an indexed MS Access table using a .dqy to
pull data into the worksheet. There are two tabs in the worksheet and each
tab uses a different .dqy.

I just got a new laptop computer that has a faster processor and more memory
than what I had before, but now the macro takes about 2 minutes to run where
before it only took about 5 seconds.

The excel workbook is on a network drive, and when other users open it and
run the macro, it runs in the same 5 seconds. When I log on to the network
using a co-worker's computer and run the macro, it runs in 5 seconds.

I have the View Page Breaks unchecked, I tried manual calculation, and have
Application.ScreenUpdating = False in the VBA code.

Any ideas? Thanks.

Below is the code:

Sub refreshAW()
Application.ScreenUpdating = False
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;M:\Data_Preparation\SALESTEAM
REPORTING\ADVISOR_WORKSHEET\2006\AW_WIR2.dqy" _
, Destination:=Range("A10"))
.Name = "AW_WIR2"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.refresh BackgroundQuery:=False
End With
Range("A10").Select
Cells.Find(What:="yyy", After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A9").Select



Range("A10").Select

ActiveSheet.Shapes("Text Box 459").Select
Selection.Delete

Sheets("BRANCHES").Select
Run ("refreshBW")

Sheets("ADVISORS").Select

Dim aclast As String
aclast = InputBox("Enter AC Last Name")


ChDir "M:\Data_Preparation\RIT_NAM_NWQ_DATA\Scorecards\WIREHOUSE_TEMPS"
ActiveWorkbook.SaveAs Filename:= _

"M:\Data_Preparation\RIT_NAM_NWQ_DATA\Scorecards\WIREHOUSE_TEMPS\ADVISOR_WORKSHEET_" & aclast & ".xls" _
, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


End Sub
Sub refreshBW()
Application.ScreenUpdating = False
With ActiveSheet.QueryTables.Add(Connection:= _
"FINDER;M:\Data_Preparation\SALESTEAM
REPORTING\ADVISOR_WORKSHEET\2006\BW_WIR2.dqy" _
, Destination:=Range("A10"))
.Name = "BW_WIR2"
.FieldNames = False
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlOverwriteCells
.SavePassword = True
.SaveData = True
.AdjustColumnWidth = False
.RefreshPeriod = 0
.PreserveColumnInfo = True
.refresh BackgroundQuery:=False
End With
Range("A10").Select
Cells.Find(What:="yyy", After:=ActiveCell, LookIn:=xlValues,
LookAt:= _
xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate


Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Delete Shift:=xlUp
Range("A9").Select



Range("A10").Select



End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top