View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jfcby[_2_] jfcby[_2_] is offline
external usenet poster
 
Posts: 121
Default Sin Button run macro Excel 2000 - 2003

Hello,

I put a worksheet toolbar Spinner Button on worksheet6 and my
reference cell is on worksheet2.
This code I put in worksheet6 module:

Private Sub SpinButton1_SpinUp()
Sheet2.Range("M4").Value = Sheet2.Range("M4").Value + 1
End Sub

Private Sub SpinButton1_SpinDown()
Sheet2.Range("M4").Value = Sheet2.Range("M4").Value - 1
End Sub

Then, I assigned this macro to the spin button using a general module:

Sub InDecreaseYear()
If Sheet2.Range("M4") = 1 Then
Call DateTesterBaselineIncrease
Call BuildCalendar_North
End If

If Sheet2.Range("M4") = 2 Then
Call DateTesterBaselineDecrease
Call BuildCalendar_North
End If

End Sub

This code will change the value in the cell from 1 to 2 and back to 1
but it will not run the macros to decrease the value it will only run
the macros to increase the value.

How can this code be changed when the spin button up is pressed those
macros will run and when pressed down those macros will run?

Thank you for your help,
jfcby