+ Reply to Thread
Results 1 to 12 of 12

My macro takes a long time to run - need to speed it up or add a progress bar

  1. #1
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    My macro takes a long time to run - need to speed it up or add a progress bar

    Hi all,

    First of all i want to thank the community here for helping me out. it has been a long and tedious process for me so far but i learnt a lot. I am stuck on this at the moment.


    It takes very long to load when i adjust the "data" sheet, Cell B1 to 10 and run my macro.
    Is there a way to optimize the code or to add a progress bar?

    This is tough for me.
    Attached Files Attached Files

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    The progress bar, no problem but is that the macro named Test?

    You should learn to cleanup you VBA project, Give the modules decriptive names and and use Option Explicit so that you are sure that all variables are formatted correctly.
    If you create order in you chaos it will make it easier to maintain
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    There is a nice tutorial here
    http://wellsr.com/vba/2017/excel/bea...-instructions/
    I have my own code but you can start practicing with this one.

    I'll put mine together for your macro and update when I am finished

  4. #4
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38
    Quote Originally Posted by Keebellah View Post
    There is a nice tutorial here
    http://wellsr.com/vba/2017/excel/bea...-instructions/
    I have my own code but you can start practicing with this one.

    I'll put mine together for your macro and update when I am finished
    Many thanks!!

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    I do not know what you did but your macro stops here

    Please Login or Register  to view this content.
    Please correct and resend the file

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    You're macro ran in an instant
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  7. #7
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    Happy sunday guys.

    I just tried it, the macro works fine for me.
    This is the macro in module 1, first sheet under the "data" tab.
    Button 1.

    Reattached spreadsheet.

    @XLADEPT - the macro starts to underperform when i increase the iterations in cell B1... It is meant to perform up to 10/11 nodes. But its horribly inefficient.
    Attached Files Attached Files

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    Well, then there is something wrong with the version you are attaching

  9. #9
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    I found the reason for the error. That is what happens when you do not take into account different country settings.
    The value in strStart is the timestamp but since it is coded like this the value decimal value is incorrect.
    I'll ignore it and work with it.

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    Having look at that I am returning the file where I placed the progress bar form in
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    06-20-2017
    Location
    london
    MS-Off Ver
    2010
    Posts
    38

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    Hi Keebellah,

    What do you mean by the value decimal value is wrong ? How do i account for different country settings?

  12. #12
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: My macro takes a long time to run - need to speed it up or add a progress bar

    The decimal symbol is not the same with every country setting.

    In some it is a . in other like here it is a ,

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. macro too long and takes too long needs simplifying
    By margal in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-26-2016, 05:26 PM
  2. [SOLVED] I have a Macro that takes a long time to run, how to make it faster
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 01-22-2016, 09:29 AM
  3. [SOLVED] Simple macro takes a long time to execute
    By jcfransen in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-11-2015, 04:31 AM
  4. Macro takes a long time to run, can this process run quicker?
    By club rat in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2014, 02:26 PM
  5. Calculation takes long time
    By dorend in forum Excel General
    Replies: 10
    Last Post: 12-13-2011, 06:17 PM
  6. how do i add time to see how long my macro takes to run
    By ernestgoh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2006, 06:10 AM
  7. Time Calculation - How long a macro takes to run
    By cdb in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-31-2005, 04:06 AM

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