Results 1 to 6 of 6

Hiding Excel SPreadsheet rows according to the values entered in a cell on the same sheet

Threaded View

  1. #1
    Registered User
    Join Date
    01-15-2012
    Location
    Hampshire
    MS-Off Ver
    Excel 2007
    Posts
    38

    Hiding Excel SPreadsheet rows according to the values entered in a cell on the same sheet

    The following is something I've lifted from another post as being a suitable solution for something I want to do in a spreadsheet - ie hide certain rows when a cell is set to certain values. The problem is I have no idea how and where to apply it to my spreadsheet. Can you point me in the right direction please. Also - are any of the names here dependent on the name of the sheet I'm applying it to or are they generic? Once I get this in and amended I'm sure it will help me along my learning curve. Thanks


    Private Sub Worksheet_Change(ByVal Target As Range) If Range("A1").Value = "1" Then Rows("2:95").EntireRow.Hidden = False Rows("3:11").EntireRow.Hidden = True Rows("15").EntireRow.Hidden = True Rows("19").EntireRow.Hidden = True Rows("20:50").EntireRow.Hidden = True ElseIf Range("A1").Value = "2" Then Rows("2:95").EntireRow.Hidden = False Rows("3:10").EntireRow.Hidden = True Rows("15").EntireRow.Hidden = True Rows("29:52").EntireRow.Hidden = True Rows("82").EntireRow.Hidden = True ElseIf Range("A1").Value = "3" Then Rows("2:95").EntireRow.Hidden = False Rows("3:20").EntireRow.Hidden = True Rows("95").EntireRow.Hidden = True ElseIf Range("A1").Value = "4" Then Rows("2:95").EntireRow.Hidden = False Rows("8:10").EntireRow.Hidden = True Rows("12").EntireRow.Hidden = True Rows("14").EntireRow.Hidden = True Rows("16").EntireRow.Hidden = True Rows("18").EntireRow.Hidden = True Rows("20").EntireRow.Hidden = True Rows("22").EntireRow.Hidden = True Rows("2:60").EntireRow.Hidden = True End If End Sub
    Last edited by orly_sm; 09-05-2012 at 09:15 AM. Reason: amend post title to conform with rules

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