Chart Number Decimal Places
....which is easily accomplished by adding this code to the worksheet:
'
' If the data validation cell changed, reset the
' spinbutton value to the number of decimal places
' in the selected chart.
'
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("F9")) Is Nothing Then
On Error Resume Next
ActiveSheet.ChartObjects(ActiveSheet.Cells(9, 6).Text).Select
decStr = ActiveChart.Axes(xlValue).TickLabels.NumberFormat
Me.SpinButton1.Value = Len(decStr) - 2 ' ignore the "0." part
On Error GoTo 0
End If
End Sub
One thing I forgot to do - when you select a new chart in the data
validation cell, it should set the current value of the spinbutton to the
decimal format for that chart.
|