Time from userform

RJPotts

Board Regular
Joined
Apr 11, 2007
Messages
139
Hi,

I'm creating a userform to enter some date into a sheet.

About half of the data the form asks for each time are times. When I tried it after setting out the form they enter (into text boxes) without problem, I'm entering in hh:mm format.

Then I started setting it up to transfer each page of information to a temp worksheet. On the text-boxes I did that with the ControlSource attribute. Is that correct?

If I then enter, say, 02:00 its transferred to the worksheet correctly but appears in the text-box on the form as 8.33333333333333E-02.

Does anyone know what I'm doing wrong & how to fix it?

Rgds & thanks in advance
Richard
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

jindon

MrExcel MVP
Joined
Aug 21, 2004
Messages
16,995
Hi
One way, writing the code onto form module
Delete ControlSouce first.
Code:
Private Sub UserForm_Initialize()
TextBox1.Value = Sheets("YourSheetNameHere").Range("YourRangeHere").Text
End Sub

This transfer what you actually see in the cell, not the value in the formula bar.
So if the cell width is not wide enough to show the data, it will also show ###### in the textbox.
 

Forum statistics

Threads
1,181,053
Messages
5,927,848
Members
436,572
Latest member
khalid hussain

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top