Hey guys,
I need a bit of help with this code I've written.
My worksheet calculates the max value from a set of cells then autoscales the chart.
The problem is, it flickers because its constantly calculating on the fly.
Some how I need to have an 'If Then' in there somewhere to tell it to only calculate when the last cell value has been entered.
Also, I've probably got way too many "With" and "End With" in the code.
The minimum scale isn't actually required because its always 0, but I can just remove that line.
Any help or advice is greatly appreciated.
Below is the code.
Cheers.
Private Sub Worksheet_Calculate()
With Sheets("graph").Select
ActiveSheet.Unprotect Password:="14505"
With ActiveSheet.ChartObjects("Chart 2").Chart
With .Axes(xlValue)
.MaximumScale = ActiveSheet.Range("y_Max").Value
.MinimumScale = ActiveSheet.Range("y_Min").Value
ActiveSheet.Protect Password:="14505"
With Sheets("cbrwsht").Select
End With
End With
End With
End With
End Sub
Bookmarks