Consulting

Results 1 to 5 of 5

Thread: Make macro timer a little bit more fancy

  1. #1

    Make macro timer a little bit more fancy

    I've retrieved a small piece of code from a different website.
    It basically calculates how long your macro takes to run.

    Dim time1 As Double, time2 As Double
    time1 = Timer
    ' <your macro here>
    time2 = Timer
    MsgBox Format(time2 - time1, "0.00 \s\ec")
    The problem is, this only shows seconds. So, instead of showing "1 min 20 secs", it will show "80 secs".
    Of course, it's not a huge problem. It would be nice to show (maybe hours) minutes and seconds though.

    I need to show how much time saving I've created. So instead of watching the clock lol, I've decided to use this instead.

    Thank You.

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    one way is:

    Dim time1 As Date
    
    time1 = Now
    
    MsgBox Format(Now - time1, "hh:mm:ss")
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Ahh, that's perfect. I've managed to get exactly what I wanted with modifying that slightly.
    Thanks

    I can't find the solved button??

  4. #4
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    welcome.

    did you try thread tools?
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  5. #5
    Got it. Cheers

Posting Permissions

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