Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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
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
Office 2007 Styles create issue with "Too many different cell form RyanAtWork Excel Discussion (Misc queries) 1 December 17th 09 03:48 AM
Date formatting issue in user form Jennifer Excel Programming 3 April 16th 05 09:49 AM
Issue with form field lengths [email protected] Excel Programming 2 January 14th 05 04:37 PM
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? Daniel[_14_] Excel Programming 1 August 29th 04 01:20 PM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM


All times are GMT +1. The time now is 10:26 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"