I have a macro in a protected worksheet that performs some calculations and updates a chart when the worksheet is activated by clicking on its tab. Within this macro, I set the minimum value of the chart's X-axis using the following command:
ActiveSheet.ChartObjects("Chart 3").Chart.Axes(xlCategory).MinimumScale = WorksheetFunction.Min(Range("U5:U7"))
Everything works perfectly when the worksheet is unprotected. When I protect the sheet, the code stops at this line and I get an error that says, “Method ‘MinimumScale’ of Object ‘Axis’ failed”
I tried to give the user permission to Edit Objects when the sheet is protected, but that doesn’t seem to work.
I suppose I could unprotect the sheet at the beginning of the macro and then protect it again at the end, but I hate to open a vulnerability. Is there a better way to do this, please? Thank you.
ActiveSheet.ChartObjects("Chart 3").Chart.Axes(xlCategory).MinimumScale = WorksheetFunction.Min(Range("U5:U7"))
Everything works perfectly when the worksheet is unprotected. When I protect the sheet, the code stops at this line and I get an error that says, “Method ‘MinimumScale’ of Object ‘Axis’ failed”
I tried to give the user permission to Edit Objects when the sheet is protected, but that doesn’t seem to work.
I suppose I could unprotect the sheet at the beginning of the macro and then protect it again at the end, but I hate to open a vulnerability. Is there a better way to do this, please? Thank you.