+ Reply to Thread
Results 1 to 5 of 5

Simple macro to hide rows running very slowly

  1. #1
    Registered User
    Join Date
    05-10-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013
    Posts
    7

    Simple macro to hide rows running very slowly

    Hi all,

    I've written this code (below) to hide rows that I don't need to be shown. I have an IF formula in column A that returns a 0 if the row should be hidden and a 1 if the cell should be shown.

    The macro functions perfectly, it is just painfully slow (45 seconds+). What can I do to speed up the code?

    Note: the UnhideAll code makes sure no cells are already hidden since the main HideRows macro only has the entirerow.hidden function, and no code to open cells that should be open. The UnhideAll macro runs fine by itself.. takes about 2 seconds on its own.

    Thanks!

    Please Login or Register  to view this content.

  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: Simple macro to hide rows running very slowly

    Are you sure it's the hide code that's causing the slowdown?

    It only takes a few seconds when I run it on it's own.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    05-10-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Simple macro to hide rows running very slowly

    Quote Originally Posted by Norie View Post
    Are you sure it's the hide code that's causing the slowdown?

    It only takes a few seconds when I run it on it's own.
    Could it be because you're running it in a blank sheet so all the cells by default will be 0?

    When I remove the UnhideAll macro it still takes an eternity

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

    Re: Simple macro to hide rows running very slowly

    Not sure that all the cells being blank/0 would make a difference.

    If it did I would have thought it would slow things down as all rows would be hidden.

    What do you have on the sheet?

    Formulas? Shapes? Controls?

    If you have a lot of formulas you could try setting calculation to manual.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-10-2013
    Location
    Florida, USA
    MS-Off Ver
    Excel 2013
    Posts
    7

    Re: Simple macro to hide rows running very slowly

    New code:

    Please Login or Register  to view this content.
    It's running in 10 seconds now- thanks!

+ 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