Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default MsgBox Format(3.767, "[hh]:mm")

On a worksheet cell, value = 3.767 and formatted "[hh]:mm"
I get 90:23 (90 hours and 23 mins)
I want to return "90:23" with VBA but I get ":01"
When i try MsgBox Format(3.767, "hh:mm") - no square brackets
I get "18:24" (the remaining hours over a multiple of 24 as expected)
Any advice will be appreciated
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default MsgBox Format(3.767, "[hh]:mm")

Hi,

Try this

myval = 3.767
MsgBox WorksheetFunction.Text(myval, "[hh]:mm")

Mike

"David" wrote:

On a worksheet cell, value = 3.767 and formatted "[hh]:mm"
I get 90:23 (90 hours and 23 mins)
I want to return "90:23" with VBA but I get ":01"
When i try MsgBox Format(3.767, "hh:mm") - no square brackets
I get "18:24" (the remaining hours over a multiple of 24 as expected)
Any advice will be appreciated

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,560
Default MsgBox Format(3.767, "[hh]:mm")

Thanks Mike, worked a treat

"Mike H" wrote:

Hi,

Try this

myval = 3.767
MsgBox WorksheetFunction.Text(myval, "[hh]:mm")

Mike

"David" wrote:

On a worksheet cell, value = 3.767 and formatted "[hh]:mm"
I get 90:23 (90 hours and 23 mins)
I want to return "90:23" with VBA but I get ":01"
When i try MsgBox Format(3.767, "hh:mm") - no square brackets
I get "18:24" (the remaining hours over a multiple of 24 as expected)
Any advice will be appreciated

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
MsgBox "Choose one ", vbYesNoCancel, " Three Options. " Steved Excel Programming 3 March 11th 09 08:27 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Excel VBA to convert "dd.MM.yy" text to "dd/MM/yyyy" format date? Paul J[_2_] Excel Programming 4 July 11th 07 11:32 AM
Scroll Bar missing "Control" tab in "Format Properties" dialog box Peter Rooney Excel Discussion (Misc queries) 5 August 24th 06 05:36 PM
Changing format of column from "general" to "currency" Old Car Excel Programming 1 April 29th 05 09:49 AM


All times are GMT +1. The time now is 03:47 AM.

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"