+ Reply to Thread
Results 1 to 6 of 6

simple macro to hide or unhide rows based on a cell value

  1. #1
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    simple macro to hide or unhide rows based on a cell value

    Hi,

    I need a simple macro that will automatically do the following:
    If cell AF44 = 0, hide rows 45 through 94.
    If cell AF44 = 1 or greater, unhide rows 45 through 94.

    Please tell me specifically where to put the macro. I'm very new to macros.

    Thanks

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: simple macro to hide or unhide rows based on a cell value

    Hi Russ,

    Put this in the Worksheet module:

    Please Login or Register  to view this content.
    Directions for running the routine(s) just supplied

    Copy the code to the clipboard

    Press ALT + F11 to open the Visual Basic Editor.

    Open a macro-enabled Workbook or save your Workbook As Macro-Enabled

    Click on the appropriate sheet

    Type "Option Explicit" then paste the code under it

    And, you should be ready to go
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: simple macro to hide or unhide rows based on a cell value

    See the attached file.

    if you push the button the code will run.

    If AF44 input is 0, and push the button, the rows will hide.
    Attached Files Attached Files
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: simple macro to hide or unhide rows based on a cell value

    And this one will do it automatic

    See the attached file.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    06-26-2013
    Location
    Powell, near Knoxville, TN
    MS-Off Ver
    Office 2010
    Posts
    26

    Re: simple macro to hide or unhide rows based on a cell value

    xladept and oeklere...thanks for the formula, It works great in a new worksheet, but not in the worksheet I'm using, Could it be because AF44 has a formula in it? =SUM(A44:P44)

    Thanks

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: simple macro to hide or unhide rows based on a cell value

    Maybe:

    Please Login or Register  to view this content.

+ 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. Macro to Hide/Unhide Multiple Rows Based on Cell Value
    By mbp727 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2013, 11:12 AM
  2. Hide/Unhide rows based on cell value in each row
    By Drewf2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-22-2013, 07:11 AM
  3. Hide/Unhide Rows Based On Cell Value
    By ZooTV92 in forum Excel General
    Replies: 5
    Last Post: 09-05-2011, 07:51 AM
  4. Unhide / Hide Rows Based on Cell Value
    By bradaresnick in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 03-02-2010, 10:02 AM
  5. hide/unhide rows based on cell value
    By alexandruc in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 10-12-2009, 06:49 AM

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