R
robs3131
Hi all,
I have an issue where code that includes using Solver is taking extremely
long to complete on a user's system (30 min) whereas on my system it
completes quickly (4 min). The user has a very similar system to mine -- in
fact, they have a slightly faster processor and slightly more RAM.
Any idea on why it may be taking so long on my user's system? FYI - the
code automatically intsalls Solver and the user verified that Solver was
checked in VBA References prior to executing the code. Below are my user's
system details:
- VOSTRO1700 system (I have a Dell Inspiron 1420 -- this is the only
significant difference between our systems)
- Intel(R) Core(TM)2 Duo CPU T5470 @ 1.6GHz processor
- 2046 MB RAM
- 32Bit Operating System
Below is the code specific to Solver in the macro:
With Sheets("Transaction Summary")
'Sort so that clear hold transactions are first on the sheet
.Cells.Sort Key1:=.Range("AI2"), Order1:=xlDescending, Header:=xlYes,
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
.AutoFilterMode = False
.Columns("A:AI").AutoFilter
.Rows("1:1").AutoFilter Field:=35, Criteria1:="here"
Sheets("Transaction Summary").Activate
'Set the binary range to be used in the sumproduct calc
ActiveWorkbook.Names.Add Name:="holdclearbin", _
RefersToR1C1:=.Range("AJ2", .Range("AI65536").End(xlUp).Offset(0, 1))
'Set the commission range for the sumproduct calculation
ActiveWorkbook.Names.Add Name:="holdclearcomm", _
RefersToR1C1:=.Range("L2", .Range("L65536").End(xlUp))
'Set the sumproduct calculation cell and range
.Range("AK1").Formula = "=SUMPRODUCT(holdclearcomm,holdclearbin)"
ActiveWorkbook.Names.Add Name:="holdclearsumprod", _
RefersToR1C1:=.Range("AK1")
'Set the sum of the commission calculation
.Range("AL1").Value = A.Offset(0, -5).Value
'Set and execute Solver
Sheets("Transaction Summary").Activate
SolverOk SetCell:="holdclearsumprod", MaxMinVal:=3,
ValueOf:=Range("AL1").Value, ByChange:="holdclearbin"
SolverAdd CellRef:="holdclearbin", Relation:=5, FormulaText:="binary"
SolverSolve userfinish:=True
End With
I have an issue where code that includes using Solver is taking extremely
long to complete on a user's system (30 min) whereas on my system it
completes quickly (4 min). The user has a very similar system to mine -- in
fact, they have a slightly faster processor and slightly more RAM.
Any idea on why it may be taking so long on my user's system? FYI - the
code automatically intsalls Solver and the user verified that Solver was
checked in VBA References prior to executing the code. Below are my user's
system details:
- VOSTRO1700 system (I have a Dell Inspiron 1420 -- this is the only
significant difference between our systems)
- Intel(R) Core(TM)2 Duo CPU T5470 @ 1.6GHz processor
- 2046 MB RAM
- 32Bit Operating System
Below is the code specific to Solver in the macro:
With Sheets("Transaction Summary")
'Sort so that clear hold transactions are first on the sheet
.Cells.Sort Key1:=.Range("AI2"), Order1:=xlDescending, Header:=xlYes,
MatchCase:= _
False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
.AutoFilterMode = False
.Columns("A:AI").AutoFilter
.Rows("1:1").AutoFilter Field:=35, Criteria1:="here"
Sheets("Transaction Summary").Activate
'Set the binary range to be used in the sumproduct calc
ActiveWorkbook.Names.Add Name:="holdclearbin", _
RefersToR1C1:=.Range("AJ2", .Range("AI65536").End(xlUp).Offset(0, 1))
'Set the commission range for the sumproduct calculation
ActiveWorkbook.Names.Add Name:="holdclearcomm", _
RefersToR1C1:=.Range("L2", .Range("L65536").End(xlUp))
'Set the sumproduct calculation cell and range
.Range("AK1").Formula = "=SUMPRODUCT(holdclearcomm,holdclearbin)"
ActiveWorkbook.Names.Add Name:="holdclearsumprod", _
RefersToR1C1:=.Range("AK1")
'Set the sum of the commission calculation
.Range("AL1").Value = A.Offset(0, -5).Value
'Set and execute Solver
Sheets("Transaction Summary").Activate
SolverOk SetCell:="holdclearsumprod", MaxMinVal:=3,
ValueOf:=Range("AL1").Value, ByChange:="holdclearbin"
SolverAdd CellRef:="holdclearbin", Relation:=5, FormulaText:="binary"
SolverSolve userfinish:=True
End With