Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:


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

share|improve this question
This is strange - on my machine your returned the expected 00:01.23. Could it be locale specific? – Peter Albert Dec 16 '13 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 – Engineer Toast Feb 27 '15 at 19:43

Can you use the .numberformat property?


Cells(2, 3) = Application.Text((1.23 / 86400), "mm:ss.00")
Cells(2, 3).NumberFormat = "mm:ss.00"
share|improve this answer

You must log in to answer this question.

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