Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Issue in VBA
:) Afternoon folks, Could anyone help here? when i create a form that when you type in the time it sends that data to the controlsource cell - no probs there but the form changes to a decimal number eg 09:00 when typed changes to 0.375 on the form, i would like this to stay as 09:00 (or whatever the value is when typed in 24hr format. oops - im using excel 2000 at my work to do this. Any Ideas? -- cdu311 ------------------------------------------------------------------------ cdu311's Profile: http://www.excelforum.com/member.php...o&userid=27051 View this thread: http://www.excelforum.com/showthread...hreadid=469163 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Issue in VBA
Put this code behind the form. As you exit the TextBox1 with the time
entered, the value is formatted to a time. I also include an enter event to ensure the value in the control source is properly formatted as the form opens. Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean) TextBox1.Value = Format(TextBox1.Value, "hh:mm") End Sub Private Sub TextBox1_Enter() TextBox1.Value = Format(TextBox1.Value, "hh:mm") End Sub -- Cheers Nigel "cdu311" wrote in message ... :) Afternoon folks, Could anyone help here? when i create a form that when you type in the time it sends that data to the controlsource cell - no probs there but the form changes to a decimal number eg 09:00 when typed changes to 0.375 on the form, i would like this to stay as 09:00 (or whatever the value is when typed in 24hr format. oops - im using excel 2000 at my work to do this. Any Ideas? -- cdu311 ------------------------------------------------------------------------ cdu311's Profile: http://www.excelforum.com/member.php...o&userid=27051 View this thread: http://www.excelforum.com/showthread...hreadid=469163 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Issue in VBA
Hi Nigel, Thanks for that - works a charm now. ;) Regards Lee Ellio -- cdu31 ----------------------------------------------------------------------- cdu311's Profile: http://www.excelforum.com/member.php...fo&userid=2705 View this thread: http://www.excelforum.com/showthread.php?threadid=46916 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Issue in VBA
i tried to impliment the same type of code for a combo box but it no work?! is there anything different required there? Private Sub Combobox2_Exit(ByVal Cancel As MSForms.ReturnBoolean) ComboBox2.Value = Format(ComboBox2.Value, "hh:mm") End Sub Private Sub Combobox2_Enter() ComboBox2.Value = Format(ComboBox2.Value, "hh:mm") End Sub sorry to be a pain -- cdu311 ------------------------------------------------------------------------ cdu311's Profile: http://www.excelforum.com/member.php...o&userid=27051 View this thread: http://www.excelforum.com/showthread...hreadid=469163 |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Form Issue in VBA
Got it. Sorry again. -- cdu311 ------------------------------------------------------------------------ cdu311's Profile: http://www.excelforum.com/member.php...o&userid=27051 View this thread: http://www.excelforum.com/showthread...hreadid=469163 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Office 2007 Styles create issue with "Too many different cell form | Excel Discussion (Misc queries) | |||
Date formatting issue in user form | Excel Programming | |||
Issue with form field lengths | Excel Programming | |||
Is it possible to open the VBA form with a link in a sheet and to pass variable from a cell to the VBA form? | Excel Programming | |||
Text Box on User Form Set Focus Issue | Excel Programming |