0

I'm trying to write a macro that takes a time value in seconds (decimal) and converts it to mm:ss.00 format (two decimal places.) The closest I've come is this:

Application.Text((1.23 / 86400), "mm:ss.00")

Which results in:

00:01.2

I can't figure out why it's not showing the second decimal place. Format() doesn't work either, it does something even weirder.

2
  • 1
    This is strange - on my machine your returned the expected 00:01.23. Could it be locale specific? Dec 16, 2013 at 7:51
  • Mine has the same result as Peter Albert. I used the immediate window for Debug.Print Application.Text((1.23 / 86400), "mm:ss.00") and the result was 00:01.23 Feb 27, 2015 at 19:43

1 Answer 1

0

Can you use the .numberformat property?

e.g.

Cells(2, 3) = Application.Text((1.23 / 86400), "mm:ss.00")
Cells(2, 3).NumberFormat = "mm:ss.00"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .