I have this code here to rescale my chart but when i run the macro my chart disappears. What could be wrong with the code? could someone try to fix it please (i am very newbie with vba code).
VBA Code:
Sub rescale()
With ActiveSheet.ChartObjects("Chart 5").Chart
.Axes(xlCategory).MaximumScale = ActiveSheet.Range("I7").Value
.Axes(xlCategory).MinimumScale = ActiveSheet.Range("H7").Value
.Axes(xlCategory).MajorUnit = ActiveSheet.Range("J7").Value
End With
With ActiveSheet.ChartObjects("Chart 5").Chart
.Axes(xlValue).MaximumScale = ActiveSheet.Range("AF11").Value
.Axes(xlValue).MinimumScale = ActiveSheet.Range("AF10").Value
.Axes(xlValue).MajorUnit = ActiveSheet.Range("AF6").Value
End With
End Sub