I have used the macro recorder to write a simple macro to use the solver, advanced filter, etc. The macro worked perfect and then I added the advanced filter portion and now it is giving the following error:
Run-time error '1004': Cannot change part of a merged cell
I don't get this because this worksheet has no merged cell, particularly in the cells that pertain to this macro.
[pre]
[/pre]
I am not a VBA guru, but this is simply filling out the advanced filter dialog box.
Your help is appreciated!
Run-time error '1004': Cannot change part of a merged cell
I don't get this because this worksheet has no merged cell, particularly in the cells that pertain to this macro.
[pre]
Code:
Sub Profit()
'
' Profit Macro
'This macro runs the solver to find the perfect markup percentage so every sale price cumulatively equals the contract value.
'
ActiveSheet.Unprotect Password:="pmcpassword"
SolverOk SetCell:="$M$3", MaxMinVal:=1, ValueOf:=0, ByChange:="$C$5", Engine:=1 _
, EngineDesc:="GRG Nonlinear"
SolverOk SetCell:="$M$3", MaxMinVal:=1, ValueOf:=0, ByChange:="$C$5", Engine:=1 _
, EngineDesc:="GRG Nonlinear"
SolverSolve UserFinish:=True
Range("E6:F21").Select
Selection.ClearContents
Range("B7").Select
Range("B6:C21").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"B2:C3"), CopyToRange:=Range("E6:F6"), Unique:=False
ActiveSheet.Protect Password:="pmcpassword", DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
When you debug, it doesn't like the following lines:
Range("B6:C21").AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range( _
"B2:C3"), CopyToRange:=Range("E6:F6"), Unique:=False
I am not a VBA guru, but this is simply filling out the advanced filter dialog box.
Your help is appreciated!