+ Reply to Thread
Results 1 to 2 of 2

Hiding rows based on multiple calculations

  1. #1
    Registered User
    Join Date
    03-22-2005
    Posts
    31

    Hiding rows based on multiple calculations

    Hi all,

    I have a spreadsheet which I need to write a macro to hide rows based on certain cells being empty or certain cells being full.

    I need the macro to look for two things in each row.

    The first thing is whether the cells within columns K, L, M and N are empty. If yes, hide row.

    If not the other thing to look for is whether cells within column N are full. If yes, hide row.

    Is it possible to write a macro for this which will loop throughout the entire sheet of around 600-700 + rows?

    I also need it to start at row 2 as row 1 has all the header information.

    Thanks heaps,

    Andrew

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

    Re: Hiding rows based on multiple calculations

    You can do this on-the-fly yourself with no programming using a KEY column and the Autofilter. Have you tried that?

    In an empty column, in Z1 put "Key" and in Z2 put this formula:

    =IF(COUNTA(K2:N2)>0, "Show", IF(N2="", "Show", "Hide"))
    ...you should receive a "Show" if the row should remain visible.

    Copy Z2 down as far as needed.

    Then click on Z1 and Data > Filter > Autofilter to turn on the filter in that column.

    Use the drop down and select "Show" and you have the layout you want.

    You may have to tweak the formula based on how the "blanks" in K:N appear...but you should be able to get it. If not, post up a sample workbook so we can see your data layout.
    _________________
    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