Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

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

1 Answer 1

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"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.