+ Reply to Thread
Results 1 to 13 of 13

Faster way to hide rows when cell equals zero

  1. #1
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Faster way to hide rows when cell equals zero

    Hello!

    I need some help. I have written a macro that will hide rows if a cell equals 0. The range of cells in which the macro looks at to see if each cell equals 0 is EE1495:EE3033. The problem is, it takes too long for the code to process completely. It takes around 2 minutes for the proper rows to be hide. This is the code I have written:

    Please Login or Register  to view this content.
    I heard that if you use an autofilter that it will go much faster but I'm not sure how to do that. And if that's not the fastest way to do it then what is?

    Thanks to everyone that helps out!

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Faster way to hide rows when cell equals zero

    howdy and welcome to the forum.....try this...

    change range to yours....change field to 135 and change creteria1 to "0"
    Please Login or Register  to view this content.
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

  3. #3
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Faster way to hide rows when cell equals zero

    It would probably be quicker for you to manually autofilter the 0s out.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  4. #4
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Faster way to hide rows when cell equals zero

    This is a report. And a macro is important to condense printing space. If I use an autofilter manually then the style with changed.

    judgeh59, I'm not sure where to put this in my code. Can you show me how you would write the entire sub?

  5. #5
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Faster way to hide rows when cell equals zero

    sure....can you update a snippet of data (cleaned up, of course) and that'll make it easier....thanks

  6. #6
    Registered User
    Join Date
    05-15-2013
    Location
    Wisconsin, USA
    MS-Off Ver
    Excel 2010
    Posts
    42

    Re: Faster way to hide rows when cell equals zero

    I remember a post in here that used a specialcells(xlblanks) to hide zero rows. He converted the 0 to a blank and then hid all of them which was incredibly quick. I just can't seem to find that post.

  7. #7
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Faster way to hide rows when cell equals zero

    Item Plan Qty Unit
    demolition 0 LF
    Demo demising 1 LF
    . . .
    . . .
    . . .

    If the Plan Qty equals zero then it will hide that row. This is 1500 rows long.
    Is this what you asked for? Sorry if it's not, I'm new here.

  8. #8
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Faster way to hide rows when cell equals zero

    give this a try....
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Faster way to hide rows when cell equals zero

    It seems to work in the example. But, It only leaves the values that are zero. I want it to filter out the 0 values.

  10. #10
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Faster way to hide rows when cell equals zero

    I guess I need to see the actually data....can you clean up the company confidential stuff and upload the file....even part of it would help....something else is happening....

  11. #11
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Faster way to hide rows when cell equals zero

    This is a small sample of the data.
    Attached Files Attached Files

  12. #12
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: Faster way to hide rows when cell equals zero

    thanks for the data....that makes it so much easier.....check it out.....
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    06-13-2013
    Location
    Chicago
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Faster way to hide rows when cell equals zero

    Thanks! This works very nicely in the example you gave me. Ill give it a try an mine now.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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