+ Reply to Thread
Results 1 to 17 of 17

Macro delay versus F8 step thru

  1. #1
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Macro delay versus F8 step thru

    My opening macro seems to have a lengthy delay compared to when I step thru it using F8. Any suggestions what one could look for causing this? Thanks.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Macro delay versus F8 step thru

    Probably delay is not really due to the macro. It's probably just file opening. Of course not seeing file nor macro it's only guessing.
    Best Regards,

    Kaper

  3. #3
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Thanks Kaper. Ya, I know it's difficult to answer without seeing the code, but the workbook is way too big to put on this forum. The file is actually open, all the macro does is display hidden worksheets, then hides two userforms to display the 10 or so worksheets as well as a new userform. I can probably F8 thru it faster than when it runs itself.

  4. #4
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Is there a way to watch the macro run through the code other than manually with F8?

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro delay versus F8 step thru

    Hi thecdnmole

    You can insert "Breakpoints" at various key lines of the Code and get a visual representation of those lines that are causing the issue.

    F5 between "Breakpoints" should show you what's causing the issue.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  6. #6
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Thanks jaslake for the suggestion, but the problem is I don't know where the issue is! If I put a line break at the start and step thru it, there is no problem, but when the macro runs, it seems to hang somewhere. But where??

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro delay versus F8 step thru

    Hi thecdnmole

    If you wish, upload the offending File...one of us will look at it.

  8. #8
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Quote Originally Posted by jaslake View Post
    Hi thecdnmole

    If you wish, upload the offending File...one of us will look at it.
    I would if I could, but the file is 10kb in size, too big for the forum and has sensitive material I would prefer the world not see. I realize that is the best way to get a good answer from you pros out there!

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro delay versus F8 step thru

    Hi thecdnmole

    My advice...

    Create a file with less Data
    Desensitize the File
    Zip it if required
    Upload it

    One of us will try to assist.

  10. #10
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    I will see if I can as it will entail a lot of work and not sure if it will work once I do.

    I just tried something, there are two userforms that appear and in the background there is about 10 worksheets being made visible. Once this happens the userforms are hidden, which the whole time from start to finish takes 36 seconds. I tried it again, but this time I unloaded the two userforms and it took 26 seconds. Does that make sense?

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro delay versus F8 step thru

    Hi thecdnmole

    No clue...Zip the File...upload...

  12. #12
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Macro delay versus F8 step thru

    Well, let's take another try without a file.

    in the code at the begining:
    Please Login or Register  to view this content.
    then in some (few in first attempt) characteristic points insert lines like:
    Please Login or Register  to view this content.
    if something is done in a short loop which you suspect then in a loop (say control variable is i) something like:
    Please Login or Register  to view this content.
    and at the end either
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.
    or write s into some cell in your workbook

    run it and step through and compare results.
    next stage you can increase density of such lines where difference occured (large one - small are normal).

    Good luck!

  13. #13
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Thanks Kaper! This helps, the little bit I've tried it does not appear the userforms are slowing things down, so that is good to know! Greatly appreciated. Still not sure if I will post spreadsheet as there would be some desensitizing to do, then after that I am not sure it would work properly.

  14. #14
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Interesting, looks like by using vba to write formula to cells uses up a lot of time, 5.7 seconds! Is there a more effecient way to do this then? These same sheets below are used in another set of forms and the only change would be from TC331 to TC51. I am thinking just using a number or letter in a cell and an "IF" statement in "Y1", =if(AA1=1,"='Facilities(TC331)'!X1,='Facilities(TC51)'!X1)
    Please Login or Register  to view this content.
    Last edited by thecdnmole; 03-29-2015 at 08:15 AM.

  15. #15
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Macro delay versus F8 step thru

    If it's really point 5 and 6 result then it's a loooong time
    Switch off automatic calculation before and restore after
    Please Login or Register  to view this content.
    probably you can swith on Manual just at the beginning of macro and restore automatic near the end.

    If recalculation is required on a way just force it for instance
    Please Login or Register  to view this content.
    As we touched this type of problems - do you have screenupdating set to false? it also slows down the execution.

  16. #16
    Forum Contributor
    Join Date
    08-22-2009
    Location
    Manitoba
    MS-Off Ver
    Office 2010
    Posts
    524

    Re: Macro delay versus F8 step thru

    Thanks again Kaper! Yes, I have screenupdating set to false. Where do I put your last suggestion, before or after the line I want to calculate?

  17. #17
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,619

    Re: Macro delay versus F8 step thru

    Before the line where you want your spreadsheet recalculated.
    So for instance before some .find or vlookup etc. or if nothing like that occurs - just before end sub/exit sub

+ 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. [SOLVED] preventing simple zoom macro from running step by step
    By reece1984 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2012, 06:13 AM
  2. Executing macro step by step PROBLEM.
    By phillipe124 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-26-2011, 09:16 AM
  3. run macro step by step. excel 2003
    By PBM in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2005, 10:19 AM
  4. [SOLVED] running macro step by step different from normal run??
    By Rinze Smit in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-26-2005, 11:05 AM
  5. [SOLVED] I need step by step instructions to create a macro for 10 imbedde.
    By diana in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-30-2005, 10:06 PM

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