PDA

View Full Version : Solved: Time as string with decimals?



Ago
04-03-2013, 10:15 AM
I try to get the Value of Column R as in the macro shows with the decimals.
Is that even possible?


Sub bbbasd()
MsgBox Format((Range("R365").Value), "nn:ss:00")
End Sub


It "works" in Excel but not in VBA.
I have tried str(), Timevalue and just Range(), but none of them seems to work.

Any ideas?

SamT
04-03-2013, 11:07 AM
Sub bbbasd()
Const FormatStyle As String = "mm:ss.nn"
MsgBox (Format((Range("A1").Value), FormatStyle))
End Sub

snb
04-04-2013, 02:01 AM
Sub M_snb()

MsgBox Range("R365").Text
End Sub

Aflatoon
04-04-2013, 03:22 AM
You can also use the Text worksheet function:
MsgBox Application.Text(Range("R365").Value, "mm:ss.00")

Ago
04-04-2013, 07:37 AM
Thank you all for the help!
It worked!