Hi,
I'am a beginner to VBA and trying to get a code running I got from a tutorial. The only thing I wanted to change is the trigger event. Change it from change cell to active worksheet.
For some reason I keep getting the compile error: a variable is not defined (or something like that, I have my excel in Dutch).
This is the code:
I hope someone can help me out.
Thanks.
I'am a beginner to VBA and trying to get a code running I got from a tutorial. The only thing I wanted to change is the trigger event. Change it from change cell to active worksheet.
For some reason I keep getting the compile error: a variable is not defined (or something like that, I have my excel in Dutch).
This is the code:
Code:
Option Explicit
Private Sub Worksheet_Activate()
With ActiveWorkbook.ChartObjects("Grafiek 14").Chart
Select Case Target.Address
Case "$B$14"
.Axes(xlCategory).MaximumScale = Target.Value
Case "$B$15"
.Axes(xlCategory).MinimumScale = Target.Value
Case "$B$16"
.Axes(xlCategory).MajorUnit = Target.Value
Case "$T$3"
.Axes(xlValue).MaximumScale = Target.Value
Case "$T$4"
.Axes(xlValue).MinimumScale = Target.Value
Case "$T$16"
.Axes(xlValue).MajorUnit = Target.Value
End Select
End With
End Sub
I hope someone can help me out.
Thanks.