MsgBox Format(3.767, "[hh]:mm")

D

David

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
 
D

David

Thanks Mike, worked a treat

Mike H said:
Hi,

Try this

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

Mike

David said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top