I'm trying to set the x-axis limits for all charts in a worksheet equal to cell values thorugh a loop but I haven't been able to quite get it working yet.
I've looked at various threads and posts on similar but there's something I haven't got quite right with my code.
VBA Code:
Sub ChartSheets_Loop()
Dim cht As ChartObject
Application.ScreenUpdating = False
'Determine Maximum value
MaxNumber = Sheet3.Range("S4").Value
'Determine Minimum value
MinNumber = Sheet3.Range("S3").Value
For Each cht In Sheet3.ChartObjects
'Rescale X-Axis
cht.Activate
cht.Chart.Axes(xlCategory).MinimumScale = MinNumber
cht.Chart.Axes(xlCategory).MaximumScale = MaxNumber
Next cht
Application.ScreenUpdating = True
End Sub
I've looked at various threads and posts on similar but there's something I haven't got quite right with my code.