![]() |
|
#1
|
|||
|
|||
![]() I have a Spin button (SpinButton1) connected to a text box (txtVersion) and I need it to increase by .1 so Version Numbers are 2.0, 2.1,2.2, etc... When I try to change the Value in Properties to 2.0 or SmallChange to .1 I get an error message. Also, if that doesn't work, is there a way to set the default value in txtVersion to "2.0" ? |
#2
|
||||
|
||||
![]()
Without actually seeing the problem userform and the code behind it, it can be difficult for anyone to diagnose the issue. Can you attach a document to a post with just the userform? You do this via the paperclip symbol on the 'Go Advanced' tab at the bottom of this screen.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
You will need to define the textbox value as a double:
Code:
Private Sub SpinButton1_SpinDown() Dim dblRev As Double dblRev = CDbl(TextBox1.Text) - 0.1 TextBox1.Text = Format(dblRev, "0.0") End Sub Private Sub SpinButton1_SpinUp() Dim dblRev As Double dblRev = CDbl(TextBox1.Text) + 0.1 TextBox1.Text = Format(dblRev, "0.0") End Sub Private Sub UserForm_Initialize() TextBox1.Text = Format(CDbl("1.0"), "0.0") End Sub |
#4
|
|||
|
|||
![]()
Thank you gmaxey that worked perfect!
![]() |
![]() |
Tags |
form field, spinbutton, vba code |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Formd | Word VBA | 11 | 11-12-2015 02:33 PM |
![]() |
maximus123 | PowerPoint | 1 | 08-04-2015 05:33 AM |
Pulling 2 digits before a decimal point from adjoining cell then zeros after decimal | jadess916 | Excel | 1 | 06-26-2014 03:48 AM |
How to copy format of a column using spin button | Tyberian1988 | Excel Programming | 2 | 03-10-2014 10:09 PM |
![]() |
hannu | Excel | 3 | 11-14-2013 01:42 AM |