frontdeskcps
New Member
- Joined
- Dec 7, 2018
- Messages
- 4
I am very new to VBA and am having a hard time understanding how the loop feature is working in relation to only charts on the current sheet. I can change an "active chart" with a VBA but need to loop it through all charts on the current sheet. I have been trying to understand it for 2 days of intense research but am lost. I only want to change the Yaxis(xlValue). The VBA I am using to make a change the value is:
Sub ScaleAxes100()
With Application.ActiveChart.Axes(xlValue, xlPrimary)
.MinimumScale = ActiveSheet.Range("af3").Value
.MaximumScale = ActiveSheet.Range("af2").Value
.MajorUnit = ActiveSheet.Range("af4").Value
End With
End Sub
I can do it with one chart but there are 24 charts on each sheet and 42 sheets to "fix".
Sub ScaleAxes100()
With Application.ActiveChart.Axes(xlValue, xlPrimary)
.MinimumScale = ActiveSheet.Range("af3").Value
.MaximumScale = ActiveSheet.Range("af2").Value
.MajorUnit = ActiveSheet.Range("af4").Value
End With
End Sub
I can do it with one chart but there are 24 charts on each sheet and 42 sheets to "fix".