![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Posts: 82
|
Hi,
Does anyone know where to start with using Spinbuttons ? I want to use a spinbutton to change the day value in in a textbox that holds the current date. But have no idea where to start ! Any help would be great ! Cheers Darren |
|
|
|
|
|
#2 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
Howdy, I have a very similar thing going on at the moment. If you Private message me your email address, I'll send you a spin button that does the days of week
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
Alternatively, just select spin button from the Control Toolbox toolbar, draw it on your page, then right click and go to Properties. In the field marked Linked Cell, put the cell rreference you want it to connect to (E.g: A2) then set Max Length to about 10,000,000 to give yourself plenty of range. Now close the Properties window and take yourself out of design mode. Now right click on the cell you linked to, and pick Format Cells.
Go to the Number tab and choose Date from the menu, and pick the type of date format you want to use. Hey presto |
|
|
|
|
|
#4 |
|
Banned
Join Date: Feb 2002
Posts: 1,582
|
Hi Darren
Paste this in the UserForm Private module, just change the names to suit. Option Explicit Dim dDate As Date Private Sub SpinButton1_SpinDown() dDate = DateValue(TextBox1.Value) - 1 TextBox1 = Format(dDate, "dd mmm yyyy") End Sub Private Sub SpinButton1_SpinUp() dDate = DateValue(TextBox1.Value) + 1 TextBox1 = Format(dDate, "dd mmm yyyy") End Sub Private Sub UserForm_Initialize() TextBox1 = Format(Date, "dd mmm yyyy") End Sub It would be a very good idea to set the "Locked" Property of TextBox1 to False while in the VBE. _________________ Kind Regards Dave Hawley OzGrid Business Applications Microsoft Excel/VBA Training ![]() [ This Message was edited by: Dave Hawley on 2002-03-25 06:31 ] |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|