Hello all,
I'm currently working on my thesis, i have about 2 weeks left before i have to hand it in. The problem lays within my macros. I have 5 macros in my sheet, when i protect the sheets, they stop working, all except 1 which is a simple print macro. I will post the macro text here, if you need the full sheet please say so. The reason some of the macros are alike is because i work in both Danish and English excel, but excel can't translate properly.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Loop_dk()
'
' PressureDrop_Loop_dk Makro
'
'
SolverReset
SolverAdd CellRef:="$BX$21", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$21", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$22", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$22", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$23", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$23", Relation:=3, FormulaText:="$BS$17"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG ikke-line¾r"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Loop_eng()
'
' PressureDrop_Loop_eng Macro
'
SolverReset
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BX$21", Relation:=1, FormulaText:="$BS$16"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BX$21", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$22", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$22", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$23", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$23", Relation:=3, FormulaText:="$BS$17"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Parallel_dk()
'
' PressureDrop_Parallel_dk Makro
'
'
SolverReset
SolverAdd CellRef:="$BN$5", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$6", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$7", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$8", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BL$4", Relation:=1, FormulaText:="$BL$10"
SolverAdd CellRef:="$BL$4", Relation:=3, FormulaText:="$BL$11"
SolverAdd CellRef:="$BL$5", Relation:=1, FormulaText:="$BL$12"
SolverAdd CellRef:="$BL$5", Relation:=3, FormulaText:="$BL$13"
SolverAdd CellRef:="$BL$6", Relation:=1, FormulaText:="$BL$14"
SolverAdd CellRef:="$BL$6", Relation:=3, FormulaText:="$BL$15"
SolverAdd CellRef:="$BL$7", Relation:=1, FormulaText:="$BL$16"
SolverAdd CellRef:="$BL$7", Relation:=3, FormulaText:="$BL$17"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG ikke-line¾r"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Parallel_eng()
'
' PressureDrop_Parallel_eng Macro
'
'
SolverReset
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BN$5", Relation:=2, FormulaText:="0"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BN$6", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$7", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$8", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BL$4", Relation:=1, FormulaText:="$BL$10"
SolverAdd CellRef:="$BL$4", Relation:=3, FormulaText:="$BL$11"
SolverAdd CellRef:="$BL$5", Relation:=1, FormulaText:="$BL$12"
SolverAdd CellRef:="$BL$5", Relation:=3, FormulaText:="$BL$13"
SolverAdd CellRef:="$BL$6", Relation:=1, FormulaText:="$BL$14"
SolverAdd CellRef:="$BL$6", Relation:=3, FormulaText:="$BL$15"
SolverAdd CellRef:="$BL$7", Relation:=1, FormulaText:="$BL$16"
SolverAdd CellRef:="$BL$7", Relation:=3, FormulaText:="$BL$17"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PrintMultipleWorksheets()
'
'Prints TitlePage and PrintPage
'
Worksheets(Array("TitlePage", "PrintPage")).PrintOut
End Sub
I'm currently working on my thesis, i have about 2 weeks left before i have to hand it in. The problem lays within my macros. I have 5 macros in my sheet, when i protect the sheets, they stop working, all except 1 which is a simple print macro. I will post the macro text here, if you need the full sheet please say so. The reason some of the macros are alike is because i work in both Danish and English excel, but excel can't translate properly.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Loop_dk()
'
' PressureDrop_Loop_dk Makro
'
'
SolverReset
SolverAdd CellRef:="$BX$21", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$21", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$22", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$22", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$23", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$23", Relation:=3, FormulaText:="$BS$17"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG ikke-line¾r"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Loop_eng()
'
' PressureDrop_Loop_eng Macro
'
SolverReset
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BX$21", Relation:=1, FormulaText:="$BS$16"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BX$21", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$22", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$22", Relation:=3, FormulaText:="$BS$17"
SolverAdd CellRef:="$BX$23", Relation:=1, FormulaText:="$BS$16"
SolverAdd CellRef:="$BX$23", Relation:=3, FormulaText:="$BS$17"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$BX$17", MaxMinVal:=3, ValueOf:=0, ByChange:="$BX$21:$BX$23" _
, Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Parallel_dk()
'
' PressureDrop_Parallel_dk Makro
'
'
SolverReset
SolverAdd CellRef:="$BN$5", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$6", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$7", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$8", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BL$4", Relation:=1, FormulaText:="$BL$10"
SolverAdd CellRef:="$BL$4", Relation:=3, FormulaText:="$BL$11"
SolverAdd CellRef:="$BL$5", Relation:=1, FormulaText:="$BL$12"
SolverAdd CellRef:="$BL$5", Relation:=3, FormulaText:="$BL$13"
SolverAdd CellRef:="$BL$6", Relation:=1, FormulaText:="$BL$14"
SolverAdd CellRef:="$BL$6", Relation:=3, FormulaText:="$BL$15"
SolverAdd CellRef:="$BL$7", Relation:=1, FormulaText:="$BL$16"
SolverAdd CellRef:="$BL$7", Relation:=3, FormulaText:="$BL$17"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG ikke-line¾r"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PressureDrop_Parallel_eng()
'
' PressureDrop_Parallel_eng Macro
'
'
SolverReset
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BN$5", Relation:=2, FormulaText:="0"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverAdd CellRef:="$BN$6", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$7", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BN$8", Relation:=2, FormulaText:="0"
SolverAdd CellRef:="$BL$4", Relation:=1, FormulaText:="$BL$10"
SolverAdd CellRef:="$BL$4", Relation:=3, FormulaText:="$BL$11"
SolverAdd CellRef:="$BL$5", Relation:=1, FormulaText:="$BL$12"
SolverAdd CellRef:="$BL$5", Relation:=3, FormulaText:="$BL$13"
SolverAdd CellRef:="$BL$6", Relation:=1, FormulaText:="$BL$14"
SolverAdd CellRef:="$BL$6", Relation:=3, FormulaText:="$BL$15"
SolverAdd CellRef:="$BL$7", Relation:=1, FormulaText:="$BL$16"
SolverAdd CellRef:="$BL$7", Relation:=3, FormulaText:="$BL$17"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$BN$4", MaxMinVal:=3, ValueOf:=0, ByChange:="$BL$4:$BL$7", _
Engine:=1, EngineDesc:="GRG Nonlinear"
SolverSolve userFinish:=True
End Sub
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Sub PrintMultipleWorksheets()
'
'Prints TitlePage and PrintPage
'
Worksheets(Array("TitlePage", "PrintPage")).PrintOut
End Sub