LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default Date Control using Spinner

Hello All,

Ok, I have a text box with the current date in, and require a spinner to increase/decrease the date. I have managed to get it to work, however once the date gets passed the end of the month, the date that's displayed in the textbox goes crazy!

The code I have used (for the spinup button) is shown below:

Private Sub SpinButton2_Spinup()

SD = Date
SD = FormatDateTime(Date, vbShortDate)

If TextBox1.Value = "" Then
TextBox1.Value = Date
TextBox1 = FormatDateTime(TextBox1.Value, vbShortDate)
Else
If Not TextBox1.Value = "" Then
SD2 = TextBox1.Value
TextBox1.Value = FormatDateTime(SD2, vbShortDate)
SD2 = DateAdd("d", 1, SD2)
TextBox1.Value = SD2
TextBox1.Value = FormatDateTime(TextBox1.Value, vbShortDate)
End If

End If

End Sub

Does anyone know how to get the spinner to increase/decrease the date simply day by day, changing as it should throughout the year?

Any help on this would be greatly appreciated.

Thanks in advance,
Stan
 
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
Increments less than one in format control box for spinner T. Valko Excel Worksheet Functions 0 September 23rd 09 09:56 PM
spinner control in chart sheet... please help! Anna Charts and Charting in Excel 3 August 10th 06 08:16 PM
spinner format control has no control tab AJ Excel Worksheet Functions 4 March 5th 06 10:30 AM
Spinner Control Properties rpalmer4 Excel Worksheet Functions 1 November 13th 05 09:40 PM
Spinner control to increment percentages KG Excel Discussion (Misc queries) 1 February 25th 05 05:14 PM


All times are GMT +1. The time now is 06:58 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"