Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a stumbling block in my code below.
If I do not assign a value to ComboBox11 (and the default value I want is 0) then I get a type mismatch error when I start to enter a number in TextBox2. If I do assign a value to ComboBox11 (using .ComboBox11.Value = "0") then everything works with the notable exception that I when I use the dropdown on the ComboBox to select one of my other choices (0, .5, 1) I can not change the value. It remains at 0 no mater what I do. Anyone have any thoughts on this? Sub TotalHours1() Dim bTest1 As Boolean Dim bTest2 As Boolean Dim bTest3 As Boolean Dim dblElapsed With UserForm1 .ComboBox11.Value = "0" If IsNumeric(.TextBox1.Text) And _ IsNumeric(.TextBox2.Text) Then dblElapsed = (CDbl(.TextBox2.Text) - CDbl(.TextBox1.Text) - CDbl(.ComboBox11.Text)) .TextBox3.Value = Format(dblElapsed, "#0.00") If .ComboBox1.Value = "" Then GoTo EnterCode GoTo EndMacro EnterCode: .ComboBox1.Value = "01" Else 'MsgBox "There is an invalid time" End If GoTo EndMacro ClearBox: UserForm1.TextBox1.Value = Format("", "") UserForm1.TextBox2.Value = Format("", "") UserForm1.TextBox3.Value = Format("", "") EndMacro: End With End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
userform textbox | Excel Worksheet Functions | |||
How to add textbox/buttons to an UserForm | Excel Programming | |||
hide a textbox on a userform? | Excel Programming | |||
UserForm TextBox to ActiveSheet TextBox over 256 characters | Excel Programming | |||
Help with Syntax UserForm TextBox | Excel Programming |