[COLOR=darkblue]Option[/COLOR] [COLOR=darkblue]Explicit[/COLOR]
[COLOR=darkblue]Private[/COLOR] [COLOR=darkblue]Sub[/COLOR] Worksheet_Change([COLOR=darkblue]ByVal[/COLOR] Target [COLOR=darkblue]As[/COLOR] Range)
[COLOR=darkblue]If[/COLOR] Target.Address <> "$A$1" [COLOR=darkblue]Then[/COLOR] [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]If[/COLOR] Len(Target) = 0 [COLOR=darkblue]Then[/COLOR] [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]If[/COLOR] [COLOR=darkblue]Not[/COLOR] IsNumeric(Target) [COLOR=darkblue]Then[/COLOR]
Target.Select
Target.ClearContents [COLOR=green]'optional[/COLOR]
MsgBox "The interval must be a number.", vbInformation
[COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
[COLOR=darkblue]If[/COLOR] Target.Value <= 0 [COLOR=darkblue]Then[/COLOR]
Target.Select
Target.ClearContents [COLOR=green]'optional[/COLOR]
MsgBox "The interval must be a whole number greater than 1.", vbInformation
[COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[COLOR=darkblue]End[/COLOR] If
Me.ChartObjects("Chart 1").Chart.Axes(xlCategory).TickLabelSpacing = Target.Value
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]