Consulting

Results 1 to 5 of 5

Thread: Solved: Time as string with decimals?

  1. #1
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location

    Solved: Time as string with decimals?

    I try to get the Value of Column R as in the macro shows with the decimals.
    Is that even possible?

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

    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?
    Attached Files Attached Files

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    [vba]Sub bbbasd()
    Const FormatStyle As String = "mm:ss.nn"
    MsgBox (Format((Range("A1").Value), FormatStyle))
    End Sub[/vba]
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,645
    [vba]Sub M_snb()
    MsgBox Range("R365").Text
    End Sub[/vba]

  4. #4
    VBAX Master Aflatoon's Avatar
    Joined
    Sep 2009
    Location
    UK
    Posts
    1,720
    Location
    You can also use the Text worksheet function:
    [vba]MsgBox Application.Text(Range("R365").Value, "mm:ss.00")
    [/vba]
    Be as you wish to seem

  5. #5
    VBAX Tutor
    Joined
    Jan 2008
    Posts
    266
    Location
    Thank you all for the help!
    It worked!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •