Hello, I make 100 years calendar and i want month and year change with active x spinbutton. in cell "B4" is number of month (1 to 12) and in cel "H4" is year. one spin buton for month change and one for year change. if in cell with month (B4) is 12 and i click to spin up (for month) i want to jump to 1 (not to 13) and year (in cell h4 ) +1 and if i click to spin down and in cell "b4" is 1 i want to jump 12 (not to 0) and decrease year by 1 ("h4")-1
i have code for jump from 12 to 1 and 1 to 12 but dont know how increase and decrease year.
my code:
Code:
Private Sub SpinButton1_SpinDown()
Range("B4").Value = Range("B4").Value - 1
If [B4] = 0 Then [B4] = 12
End Sub
Private Sub SpinButton1_SpinUp()
Range("B4").Value = Range("B4").Value + 1
If [B4] = 13 Then [B4] = 1
End Sub