+ Reply to Thread
Results 1 to 7 of 7

Excel with macro taking very long to open up

  1. #1
    Registered User
    Join Date
    02-03-2021
    Location
    singapore
    MS-Off Ver
    2016
    Posts
    4

    Excel with macro taking very long to open up

    Hello Everyone,
    This is my first post here.

    I have an Excel which executes the following code when it is opened-

    Please Login or Register  to view this content.
    Each macro is fetching data from different excel and pasting it in current excel. I have already optimized most of them but the excel is still taking close to 30 seconds to open.

    I was thinking following Macro6 is the problem but I can't find a way to further optimize it. Adding sample code below-
    Please Login or Register  to view this content.

    Any suggestions would be appreciated.

    Thank you!

  2. #2
    Forum Contributor
    Join Date
    11-20-2007
    Location
    Felixstowe, England
    MS-Off Ver
    Excel 2013, 2019
    Posts
    217

    Re: Excel with macro taking very long to open up

    Did you put any monitoring in, like, for example, to see how long it takes to open whatever workbook is targeted in the code? If that is taking a long time, then you are not going to be able to speed it up in the macro.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,425

    Re: Excel with macro taking very long to open up

    From a diagnostic perspective, you could use Debug.Print to display the current time and/or calculate the duration of each stage of the process. That might isolate lengthy processing times.

    In terms of improvement, two options spring to mind. One, you could use a Helper column with the formula =MOD(ROW(), 2) and filter on the Helper column. Copy visible rows and paste the values, then delete the Helper column. Or, two, you could read the range into an array, process the array, copying every other cell to a second array, then post the second array to the output sheet.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    02-03-2021
    Location
    singapore
    MS-Off Ver
    2016
    Posts
    4

    Re: Excel with macro taking very long to open up

    I actually did not. I am pretty new to this. but thanks for the suggestion. I will try to implement this.

  5. #5
    Registered User
    Join Date
    02-03-2021
    Location
    singapore
    MS-Off Ver
    2016
    Posts
    4

    Re: Excel with macro taking very long to open up

    Quote Originally Posted by GlennUK View Post
    Did you put any monitoring in, like, for example, to see how long it takes to open whatever workbook is targeted in the code? If that is taking a long time, then you are not going to be able to speed it up in the macro.
    I actually did not. I am pretty new to this. but thanks for the suggestion. I will try to implement this.

  6. #6
    Registered User
    Join Date
    02-03-2021
    Location
    singapore
    MS-Off Ver
    2016
    Posts
    4

    Re: Excel with macro taking very long to open up

    Quote Originally Posted by TMS View Post
    From a diagnostic perspective, you could use Debug.Print to display the current time and/or calculate the duration of each stage of the process. That might isolate lengthy processing times.

    In terms of improvement, two options spring to mind. One, you could use a Helper column with the formula =MOD(ROW(), 2) and filter on the Helper column. Copy visible rows and paste the values, then delete the Helper column. Or, two, you could read the range into an array, process the array, copying every other cell to a second array, then post the second array to the output sheet.
    I liked both of your options for improvement. In theory, the helper column method looks easier. I will try to implement that. Thank you for your suggestion.

  7. #7
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Excel with macro taking very long to open up

    You might try hiding the alternating columns in one loop, and then copying only the visible cells as needed, and unhiding when done.

+ 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. VBA and Checkbox Speadsheet taking long to open
    By Phlebas0403 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-09-2017, 07:24 AM
  2. Excel Macro searching value in an array taking really long
    By realdemigod in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-17-2014, 12:16 PM
  3. Downloaded Excel file taking long time to open
    By Nanjunda in forum Excel General
    Replies: 1
    Last Post: 11-14-2013, 09:10 AM
  4. Macro taking too long to execute
    By jacob@thepenpoint in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2012, 05:13 PM
  5. Linked workbooks taking too long to open
    By treva31 in forum Excel General
    Replies: 2
    Last Post: 11-24-2010, 10:56 PM
  6. Problem with spreadsheet taking a long time to open
    By clowrym in forum Excel General
    Replies: 4
    Last Post: 05-29-2009, 01:14 PM
  7. Excel taking too long to open up
    By dkblee in forum Excel General
    Replies: 1
    Last Post: 03-26-2006, 06:35 AM

Tags for this Thread

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