+ Reply to Thread
Results 1 to 5 of 5

Macro to Hide/Unhide rows based on the result of a formula

  1. #1
    Registered User
    Join Date
    01-20-2015
    Location
    Northern, Michigan
    MS-Off Ver
    2010
    Posts
    3

    Macro to Hide/Unhide rows based on the result of a formula

    I am new to vba and have been searching for a way to automatically hide rows based on the result of a formula that returns either Y or N. The following code is what I have found but it only works if I enter Y or N. What do I need to change in order to make it work with a formula result rather than a manual entry? Any help would be appreciated.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,417

    Re: Macro to Hide/Unhide rows based on the result of a formula

    That code WILL actually work because it fires on ANY change.

    So, if for example, M39 has
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    and you enter "N" in cell A1, the event handler will fire and find the value "N" in cell M39.

    You probably DON'T want it to fire every change though.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    01-20-2015
    Location
    Northern, Michigan
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to Hide/Unhide rows based on the result of a formula

    I've been playing with this and realize what my issue is, the Y/N is picked from a pull down on another worksheet "DATA_INPUT" and looks like this

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    The worksheet "QUOTE" which I have the macro assigned to is a completely generated sheet with no input on it, it is simply a results page. I guess my question now is what do I need to change in order to allow this macro to work with a result from another worksheet?

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,417

    Re: Macro to Hide/Unhide rows based on the result of a formula

    Put the event handler behind the Data_Input worksheet and monitor cell B18

  5. #5
    Registered User
    Join Date
    01-20-2015
    Location
    Northern, Michigan
    MS-Off Ver
    2010
    Posts
    3

    Re: Macro to Hide/Unhide rows based on the result of a formula

    I'm not sure what you mean by event handler. My experience with vba is about one day of doing Google searches. Could you show me what you are describing to do? Thank you for your help so far.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. hide and unhide rows based on formula result
    By tjanda in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-28-2012, 04:20 AM
  2. [SOLVED] Hide/Unhide Rows Based On Cell Result
    By stockjc in forum Excel General
    Replies: 5
    Last Post: 08-29-2012, 09:37 PM
  3. Replies: 1
    Last Post: 08-21-2012, 02:46 PM
  4. Hide/Unhide rows based on cell value (result of formula)
    By tjanda in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-17-2012, 05:57 PM
  5. Auto Hide/Unhide rows in Excel based on formula result in a column
    By crozierk in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 08-12-2012, 08:02 AM

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