tammyl
11-29-2008, 10:17 PM
Hi,
I'm trying to run a macro when a spinner value is changed.
I have a spinner button control 'spinner 3' linked to cell '$A$2'.
Currently this cell has a year value. Eg: 2008
In cell A5 I have formula =Date(TheYear,1,1) 'Equals 2008/1/1
'TheYear' is the defined name of the spinner cell $A$2.
When the value changes in cell A2 using the spinner button, I wish to run this macro. It does a fill date series.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Range
For Each i In Target
If i.Address = "$A$2" Then
Range("A5:A375").Select
Selection.DataSeries Rowcol:=xlColumns, Type:=xlChronological, Date:= _
xlDay, Step:=1, Trend:=False
Range("B6").Select
End If
End Sub
The macro is not called when I use the spinner button to change the A2 cell value, I think the macro needs me to manually change it. Is there a way I can link the macro to run.
Cheers tammyl
I'm trying to run a macro when a spinner value is changed.
I have a spinner button control 'spinner 3' linked to cell '$A$2'.
Currently this cell has a year value. Eg: 2008
In cell A5 I have formula =Date(TheYear,1,1) 'Equals 2008/1/1
'TheYear' is the defined name of the spinner cell $A$2.
When the value changes in cell A2 using the spinner button, I wish to run this macro. It does a fill date series.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Range
For Each i In Target
If i.Address = "$A$2" Then
Range("A5:A375").Select
Selection.DataSeries Rowcol:=xlColumns, Type:=xlChronological, Date:= _
xlDay, Step:=1, Trend:=False
Range("B6").Select
End If
End Sub
The macro is not called when I use the spinner button to change the A2 cell value, I think the macro needs me to manually change it. Is there a way I can link the macro to run.
Cheers tammyl