rogernz
Board Regular
- Joined
- Jul 21, 2004
- Messages
- 93
My code is below, I recorded most of it, and edited it to suit, now when I go to run the code is says it is missing a sub or function when it gets to the solver part of the code - umm, some help please, I imagine I am missing a small piece of code at the beginning of this part of the code - but no idea what.
Thanks in advance
Sub Skin_detail()
' macro to display skin requirements
Sheets("CHASSIS STRESS").Select
Application.Run "'TSV CHASSIS STRESS CALCULATOR (V5.3 - TRUCK SELECT).xls'!FRONT"
ActiveSheet.Unprotect
Range("D33") = "=zrangemain"
Range("D34") = "=zrangemain"
SolverOk SetCell:="$H$33", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user1"
SolverAdd CellRef:="user1", Relation:=1, FormulaText:="$B$29"
SolverAdd CellRef:="user1", Relation:=3, FormulaText:="0"
SolverSolve
Range("C84") = "=user1"
'front max start requirement set, now calculate front max end requirement
SolverOk SetCell:="$H$34", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user2"
SolverAdd CellRef:="user2", Relation:=1, FormulaText:="$B$30"
SolverAdd CellRef:="user2", Relation:=3, FormulaText:="$B$29"
SolverSolve
Range("D84") = "=user2"
Range("C84:D84").Copy
Range("C84").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'front max end requirement set, now change to rear max
Sheets("CHASSIS STRESS").Select
Application.Run "'TSV CHASSIS STRESS CALCULATOR (V5.3 - TRUCK SELECT).xls'!rear"
ActiveSheet.Unprotect
SolverOk SetCell:="$H$33", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user1"
SolverAdd CellRef:="user1", Relation:=1, FormulaText:="$B$29"
SolverAdd CellRef:="user1", Relation:=3, FormulaText:="0"
SolverSolve
Range("C85") = "=user1"
'rear max start requirement set, now calculate rear max end requirement
SolverOk SetCell:="$H$34", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user2"
SolverAdd CellRef:="user2", Relation:=1, FormulaText:="$B$30"
SolverAdd CellRef:="user2", Relation:=3, FormulaText:="$B$29"
SolverSolve
Range("D85") = "=user2"
Range("C85:D85").Copy
Range("C85").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'both limits now set, now add vertical bars to graph to display results...
End Sub
Thanks in advance
Sub Skin_detail()
' macro to display skin requirements
Sheets("CHASSIS STRESS").Select
Application.Run "'TSV CHASSIS STRESS CALCULATOR (V5.3 - TRUCK SELECT).xls'!FRONT"
ActiveSheet.Unprotect
Range("D33") = "=zrangemain"
Range("D34") = "=zrangemain"
SolverOk SetCell:="$H$33", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user1"
SolverAdd CellRef:="user1", Relation:=1, FormulaText:="$B$29"
SolverAdd CellRef:="user1", Relation:=3, FormulaText:="0"
SolverSolve
Range("C84") = "=user1"
'front max start requirement set, now calculate front max end requirement
SolverOk SetCell:="$H$34", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user2"
SolverAdd CellRef:="user2", Relation:=1, FormulaText:="$B$30"
SolverAdd CellRef:="user2", Relation:=3, FormulaText:="$B$29"
SolverSolve
Range("D84") = "=user2"
Range("C84:D84").Copy
Range("C84").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'front max end requirement set, now change to rear max
Sheets("CHASSIS STRESS").Select
Application.Run "'TSV CHASSIS STRESS CALCULATOR (V5.3 - TRUCK SELECT).xls'!rear"
ActiveSheet.Unprotect
SolverOk SetCell:="$H$33", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user1"
SolverAdd CellRef:="user1", Relation:=1, FormulaText:="$B$29"
SolverAdd CellRef:="user1", Relation:=3, FormulaText:="0"
SolverSolve
Range("C85") = "=user1"
'rear max start requirement set, now calculate rear max end requirement
SolverOk SetCell:="$H$34", MaxMinVal:=3, ValueOf:="130.66", ByChange:="user2"
SolverAdd CellRef:="user2", Relation:=1, FormulaText:="$B$30"
SolverAdd CellRef:="user2", Relation:=3, FormulaText:="$B$29"
SolverSolve
Range("D85") = "=user2"
Range("C85:D85").Copy
Range("C85").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
'both limits now set, now add vertical bars to graph to display results...
End Sub