View Full Version : Time question
hexOffender
01-02-2007, 01:24 PM
I have a form that accepts a time entered as "12:50 PM", then saves the workbook. WHen the time is displayed in a textbox it is a fraction "0.534722222222222". The cell is formatted as time, but it still displays as the fraction.:banghead:
Zack Barresse
01-02-2007, 01:50 PM
Hi there, welcome to the board!!
Depending on how you are showing the data (you said textbox and cell, two very different things) you may need to use the Format() function. Can you provide more details about what you are trying to do and what you are working with?
Bob Phillips
01-03-2007, 05:21 AM
Try loading the textbox using the Text property, not Value
Me.textBox1.Text = Worksheets("Sheet1").Range("A1").Text
hexOffender
01-03-2007, 02:22 PM
I added ".Text" and that fixed er right up...
.txtTime.Value = Cells(ActiveCell.Row, 10).Text
Zack Barresse
01-03-2007, 02:32 PM
Or, to keep your code more dynamic, I still recommend using the Format() method, so it doesn't matter how your text is displayed on your worksheet, as long as it is still a recognized date (by Excel)...
txtTime.Value = Format(Cells(ActiveCell.Row, 10).Value, "hh:mm AM/PM")
HTH
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.