+ Reply to Thread
Results 1 to 11 of 11

Auto Hide and Unhide Rows Based

Hybrid View

  1. #1
    Registered User
    Join Date
    12-02-2013
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Auto Hide and Unhide Rows Based

    That is correct but in the case of C12 I want to hide rows 1 to 13 only, and I was hoping it will just be the same formula for the others from which if C21 have #NUM! result also I'll be hiding rows 14 to 22, for C31 hide rows 23 to 32, for C41 hide rows 33 to 42 and so forth. upon using the formula above from my first post:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Range("C12").Value = CVErr(xlErrNum) Then
    Rows("1:13").EntireRow.Hidden = True
    Else
    Rows("1:13").EntireRow.Hidden = False
    End If
    End Sub

    I was able to hide rows 1 to 13 but upon filling up data on the TallySheet to test it, unfortunately it did not automatically unhide and returned an error message from which I need to debug the line: If Range("C12").Value = CVErr(xlErrNum) Then.
    Last edited by Kosmik; 12-03-2013 at 01:43 PM.

  2. #2
    Forum Contributor
    Join Date
    09-24-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Auto Hide and Unhide Rows Based

    I will have to work on this some more .. just cant seem to get the code to unhide when a value is in cell C12..

  3. #3
    Registered User
    Join Date
    12-02-2013
    Location
    Manila, Philippines
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Auto Hide and Unhide Rows Based

    Quote Originally Posted by moonsaga View Post
    I will have to work on this some more .. just cant seem to get the code to unhide when a value is in cell C12..
    Thanks! That's also my problem whenever a value is present in C12 it does not unhide. That is why I posted it here for possible solutions.

  4. #4
    Forum Contributor
    Join Date
    09-24-2013
    Location
    Dallas, Texas
    MS-Off Ver
    Excel 2007
    Posts
    128

    Re: Auto Hide and Unhide Rows Based

    I think i got it working now...
    Private Sub worksheet_SelectionChange(ByVal Target As Range)
        Dim cn As Range
        Set cn = Range("C12")
        On Error GoTo endbit:
            If cn.Value = CVErr(xlErrNum) Then
             Rows("1:13").EntireRow.Hidden = True
            Exit Sub
    endbit:
            On Error Resume Next
            Rows("1:13").EntireRow.Hidden = False
    End If
    End Sub
    the above code will hide the row range when there is the #NUM! error in C12 of the Summary sheet and if there is no #NUM! error in C12 on the Summary sheet it will unhide the row range.
    I hope this works for you. let me know.

+ 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. Auto Hide/Unhide rows in Excel based on radio button selection
    By awill110 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-30-2013, 03:05 PM
  2. Auto Hide & Unhide Rows Upon Sheet Selection
    By Sleeper in forum Excel General
    Replies: 4
    Last Post: 01-24-2013, 02:00 PM
  3. 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
  4. Auto hide/unhide based on input
    By UnSpoknOne in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-03-2011, 06:11 PM
  5. Auto Hide or Unhide rows.
    By Michael S in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2009, 06:04 PM

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