+ Reply to Thread
Results 1 to 4 of 4

Formatting stopwatch-macro output to mm:ss.s

  1. #1
    Registered User
    Join Date
    06-19-2013
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Formatting stopwatch-macro output to mm:ss.s

    Hi!

    I've borrowed a piece of code from a forum for a stopwatch that handles fractions of seconds (see code below). I want it to display down to 0.1s resolution in the format mm:ss,s but at the moment it runs the seconds up to 99. I guess that it is only showing seconds, but with a colon between the 100 and 10-number.

    I'm very new to VBA-coding. I've tried lots of variants for the line with "Format((myTime + TotalTime), "00:00.0")" and formatting of the cell outside the VBA. I'm running on Swedish language- and region setting, if that is of any influence.

    Any tips on solving the matter would be greatly appreciated!

    Also a comment on what's happening in cell AA1 and why would help me onwards...

    Best regards, Karrock

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Formatting stopwatch-macro output to mm:ss.s

    Have you tried setting the time format like this?

    Please Login or Register  to view this content.
    Alf

  3. #3
    Registered User
    Join Date
    06-19-2013
    Location
    Gothenburg, Sweden
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Formatting stopwatch-macro output to mm:ss.s

    Hej Alf!

    I've tried, and get a runtime error 1004. When i write "[t]:mm:ss.000" in the format-expression above the timer appear strange on the screen.

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: Formatting stopwatch-macro output to mm:ss.s

    Sorry about that. The number format is given as "[t]:mm:ss.000" but when I recorded a macro setting cell format it was recorded as "[h]:mm:ss.000" ???

    On the other hand I changed the line
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    and this seems to work.

    As I'm using an English setup of Excel I've tested you macro using "Sheet1" insted of "Blad1"

    I'm puzzled about "Blad1" I would have expected "Ark1" since you probably are using a Swedish version?

    Just curious.

    Alf
    Last edited by Alf; 07-03-2013 at 01:12 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1