I am writing a code in which I set those two ranges:
Set ColorSAP = SAP_Comparison.Range("C3:AG19")
Set ColorPlan = Production_Plan.Worksheets("Schedule").Range(Cells(4,
MonthS), Cells(20, (MonthE - 1)))
MonthS
and MonthE
are integers.
Production_plan
is a workbook.
SAP_Comparison
is a workbook.
I have no idea why I get a error for the second but not for the first since they are very similar. I have even tested easier cases and this kind of usage do work.
Error: Run-Time '1004'
Application-defined or object-defined error.
How can I solve this?