Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format function doesn't recognise [hh]:mm

Hi,

Is there a way of getting the format function in VBA or anothe
function that will do the same job to recognise the custom forma
[hh]:mm?

When reopening a user form, it fills in the values from the relevan
line on the worksheet into the boxes.
However as the time in the worksheet can be over 24 hours, e.g. 4
hours (by using the custom format [hh]:mm), I would like the box i
the user form to show the value in hours and minutes too even if it i
above 23:59:59.

This does not work
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "[hh]:mm")


This only works for values under 24:00
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "hh:mm")


cboResponse1.Value = ActiveCell.Offset(0, 8).Value
and this return just displays the time in a numerical format e.g
1.45.....


Thanks for any help you can give
Jenni

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Format function doesn't recognise [hh]:mm

On Mon, 5 Apr 2004 08:32:07 -0500, jennie
wrote:

Hi,

Is there a way of getting the format function in VBA or another
function that will do the same job to recognise the custom format
[hh]:mm?

When reopening a user form, it fills in the values from the relevant
line on the worksheet into the boxes.
However as the time in the worksheet can be over 24 hours, e.g. 48
hours (by using the custom format [hh]:mm), I would like the box in
the user form to show the value in hours and minutes too even if it is
above 23:59:59.

This does not work
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "[hh]:mm")


This only works for values under 24:00
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "hh:mm")


cboResponse1.Value = ActiveCell.Offset(0, 8).Value
and this return just displays the time in a numerical format e.g.
1.45.....


Thanks for any help you can give
Jennie



[h] is NOT a listed user-defined format string for the VBA Format function.

I believe you could use the TEXT worksheet function, though:

cboResponse1.Value = worksheetfunction.text _
(ActiveCell.Offset(0, 8).Value,"[hh]:mm")


--ron
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Format function doesn't recognise [hh]:mm

jennie,

Failing something more elegant, you could 'force' it with something like
this:

Sub Tester()
cboResponse1.Value = fTimeText(ActiveCell.Offset(0, 8).Text)
End Sub
Function fTimeText(stest)
If stest < Empty Then
ColonPos = InStr(1, stest, ":")
H = Left(stest, ColonPos - 1)
M = Right(stest, Len(stest) - ColonPos)
fTimeText = H & ":" & M
End If
End Function

HTH,
Shockley



"jennie " wrote in message
...
Hi,

Is there a way of getting the format function in VBA or another
function that will do the same job to recognise the custom format
[hh]:mm?

When reopening a user form, it fills in the values from the relevant
line on the worksheet into the boxes.
However as the time in the worksheet can be over 24 hours, e.g. 48
hours (by using the custom format [hh]:mm), I would like the box in
the user form to show the value in hours and minutes too even if it is
above 23:59:59.

This does not work
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "[hh]:mm")


This only works for values under 24:00
cboResponse1.Value = Format (ActiveCell.Offset(0, 8).Value, "hh:mm")


cboResponse1.Value = ActiveCell.Offset(0, 8).Value
and this return just displays the time in a numerical format e.g.
1.45.....


Thanks for any help you can give
Jennie


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format function doesn't recognise [hh]:mm

Thank you for your help
I will go and try them!

Thanks again
Jenni

--
Message posted from http://www.ExcelForum.com

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
Conditional Sum function does recognise % Geoff Newham Excel Worksheet Functions 2 July 28th 09 10:14 AM
conitif doesn't recognise time format? how to get round this? mavgn Excel Worksheet Functions 11 April 16th 08 10:30 PM
How to get an Excel function to recognise text PMC1 Excel Discussion (Misc queries) 1 January 15th 07 04:00 PM
excel can no longer recognise format mdavis27 Excel Discussion (Misc queries) 0 July 2nd 06 10:48 PM
Is there a way for excel to recognise that €0.00 = 0 for the purposes IF function ? CmTaz Excel Discussion (Misc queries) 4 March 6th 06 03:45 AM


All times are GMT +1. The time now is 06:59 PM.

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

About Us

"It's about Microsoft Excel"