+ Reply to Thread
Results 1 to 7 of 7

Hiding rows based on a conditional

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Hiding rows based on a conditional

    I'm trying to properly hide rows using a macro/conditionals and I'm a bit lost on how exactly to get the macro to function for this.

    Here's the layout I'm using, basically this is an "information" sheet that pulls data from other sheets in a nice uniform way.

    I want rows 20-29 to be visible if any of the values in F20:F28 are >= 1 and hide them if all of the values in F20:F28 are <= 1

    What's the best way to setup the macro for this?
    Last edited by ryannjohnsonn; 08-25-2012 at 04:14 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 365 on Win11 (365 on Win11 (desktop), 365 on Win11 (notebook)
    Posts
    8,207

    Re: Hiding rows based on a conditional

    Hi, ryannjohnsonn,

    sorry but I can´t download your attachment. Are there formulas in the range or are these values? How does the data get into that sheet (sorry, but no file).

    Ciao,
    Holger

  3. #3
    Registered User
    Join Date
    08-24-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hiding rows based on a conditional

    I just went through and edited out all the confidential fun stuff... here is a similar
    Last edited by ryannjohnsonn; 08-25-2012 at 04:13 AM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 365 on Win11 (365 on Win11 (desktop), 365 on Win11 (notebook)
    Posts
    8,207

    Re: Hiding rows based on a conditional

    Hi, ryannjohnsonn,

    please test the following code which may be called from the procedure writing data (or call it whenever that sheet is activated). You will need to adapt the ranges as I was confused when I saw the workbook having read the description first:

    Please Login or Register  to view this content.
    Ciao,
    Holger

  5. #5
    Registered User
    Join Date
    08-24-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hiding rows based on a conditional

    Thanks for the quick reply but that didn't end up doing what I was looking for.

    Edit: perhaps I'm "over explaining" it.

    Basically, I want it to sum F23:F28, and if that value equals less than 1 I want it to hide rows 20:29. If that value is greater than 1 I want it to unhide rows 20:29.

    edit edit: and it only needs to do it once when the workbook is opened.
    Last edited by ryannjohnsonn; 08-25-2012 at 03:56 AM.

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 365 on Win11 (365 on Win11 (desktop), 365 on Win11 (notebook)
    Posts
    8,207

    Re: Hiding rows based on a conditional

    Hi, ryannjohnsonn,

    well, it might have been me as well misunderstanding what you are looking for.

    How about
    Please Login or Register  to view this content.
    This code could either be copied to the Workbook_Open-Event in ThisWorkbook or be called from there.

    Ciao,
    Holger

  7. #7
    Registered User
    Join Date
    08-24-2012
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    17

    Re: Hiding rows based on a conditional

    That worked great, thanks Holger!

+ 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