+ Reply to Thread
Results 1 to 7 of 7

Optimizing code speed: Hiding rows with loops - looking for faster way

  1. #1
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Optimizing code speed: Hiding rows with loops - looking for faster way

    Hello!
    The following code hid the rows of the listed cells if the cell does not contain anything if I click on the checkbox in my sheet and unhides them if I click again. The problem is that it needs about 5 to 7 seconds for the rows to disappear and I would like to have it faster. Does anyone have an idea how to get the same result faster? Without that many loop stages?
    Please Login or Register  to view this content.
    Greetings,
    Taktiker
    Last edited by Taktiker; 11-07-2012 at 04:24 PM.

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    Try this.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    My this is awesome! From 6-7 seconds to 0,1 seconds. Unbelievable. Thanks

  4. #4
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    Actually, I have another code: Its the second rowhiding and is intended to hide the capture-rows. It is essentially a similar code, but a bit different. Dont be scared by its size, its just the same 9 times for 9 rows. I didn't see a way to use the union thing, so my question is: Is there a way to optimize it? So its so super fast, too?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    bump, bc its already on the end of page 2

  6. #6
    Forum Contributor
    Join Date
    06-27-2006
    Posts
    310

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    You could name the ranges to simplify your code.
    For example...
    Please Login or Register  to view this content.
    You can delete it after you run it

    Then reduce your original code to...
    Please Login or Register  to view this content.
    Let me know if it works as intended, I only did a partial test
    Last edited by SuitedAces; 11-04-2012 at 11:19 PM.

  7. #7
    Registered User
    Join Date
    08-19-2012
    Location
    Germany
    MS-Off Ver
    Excel 2010
    Posts
    50

    Re: Optimizing code speed: Hiding rows with loops - looking for faster way

    Application.ScreenUpdating = False & True already fixed the problem. It does essentially what I wanted, not showing the calculationstuff and needs less time. Thx!

+ 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