Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 2
Default calendar spinbutton

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default calendar spinbutton

Hi,

Am Thu, 27 Nov 2014 15:32:49 +0000 schrieb Avexon:

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


in properiy window for the spinbutton set min to 0 and max to 13 and
linked cell to Sheet1!B4:

Private Sub SpinButton1_SpinDown()
With ActiveSheet
If .SpinButton1 < 1 Then
.SpinButton1 = 12
.Range("H4") = .Range("H4") - 1
End If
End With
End Sub

Private Sub SpinButton1_SpinUp()
With ActiveSheet
If .SpinButton1 12 Then
.SpinButton1 = 1
.Range("H4") = .Range("H4") + 1
End If
End With
End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Junior Member
 
Posts: 2
Default

Thank you!
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Spinbutton kirkm[_8_] Excel Programming 2 April 14th 09 10:54 AM
Spinbutton pcor New Users to Excel 2 November 6th 07 03:16 PM
Spinbutton Ben B Excel Discussion (Misc queries) 3 March 9th 06 11:38 AM
spinbutton? CG Rosén Excel Programming 1 November 29th 04 11:16 PM
SpinButton Problem Pete Csiszar Excel Programming 7 January 1st 04 02:31 AM


All times are GMT +1. The time now is 08:08 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"