+ Reply to Thread
Results 1 to 4 of 4

Code to Hide and Unhide Rows

  1. #1
    Registered User
    Join Date
    01-09-2012
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Code to Hide and Unhide Rows

    Wonder if anyone can help speed up the code I've written below. I'm not a VBA guru so I'm sure there is something I'm missing.

    I have a worksheet with a range of rows I want to hide based on the contents of column A. If column A is "", I want to hide the row. Otherwise the row is to remain visible. There is no data entry in the sheet, everything is being pulled from other worksheets or workbooks. Once all the other sheets and books have been updated, I have the user press <Shift><Ctrl><A> to run this code.

    This code works fine, just VERY slow. Takes about 10 seconds on my dinosaur. Any help speeding this up would be appreciated.

    JC


    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    09-27-2011
    Location
    Poland
    MS-Off Ver
    Excel 2007
    Posts
    1,312

    Re: Code to Hide and Unhide Rows

    I am not sure that speed up much yuor code buy try this
    Please Login or Register  to view this content.
    In my opinion the problem is not in the code (this kind of code sholud not run 10sec)
    Regards

    tom1977

    If You are satisfied with my solution click the small star icon on the left to say thanks.

  3. #3
    Registered User
    Join Date
    01-09-2012
    Location
    Stephens City, VA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Code to Hide and Unhide Rows

    Thanks Tom ... you were right, didn't really speed things up but I think it cleaned up my code some. It did get me to thinking about why it was taking so long to run the macro. My sheet has a LOT of calculations and lookups. I turned auto calc off at the beginning of the code and then back on. Solved the problem.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Code to Hide and Unhide Rows

    If that takes care of your need, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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