+ Reply to Thread
Results 1 to 3 of 3

Drop down list for hiding lines

Hybrid View

Spencinator Drop down list for hiding... 10-14-2008, 10:33 AM
Spencinator Dear all I need your help!... 10-14-2008, 10:48 AM
royUK Try this Option Explicit... 10-14-2008, 11:02 AM
  1. #1
    Registered User
    Join Date
    08-28-2008
    Location
    Switzerland
    Posts
    24

    Drop down list for hiding lines

    Dear all

    I need your help! I would like to have a drop down list with 3 entries.

    If you choose entry number 1, Lines 10 to 14 are hidden.
    If you choose entry number 2, Lines 15 to 29 are hidden and lines 10 to 14 are unhidden.
    If you choose entry number 3, Lines 20 to 25 are hidden and lines 10 to 29 are unhidden

    Until now i have the following:

    [Private Sub Worksheet_Change(ByVal Target As Range)

    Rows("10:25").Select
    Selection.EntireRow.Hidden = False

    If Range("A1") = "1" Then
    Rows("10:14").Select
    Selection.EntireRow.Hidden = True
    ElseIf Range("A1") = "2" Then
    Rows("15:19").Select
    Selection.EntireRow.Hidden = True
    ElseIf Range("A1") = "3" Then
    Rows("20:24").Select
    Selection.EntireRow.Hidden = True
    End If
    End Sub]
    Last edited by Spencinator; 10-17-2008 at 05:38 AM.

  2. #2
    Registered User
    Join Date
    08-28-2008
    Location
    Switzerland
    Posts
    24
    Dear all

    I need your help! I would like to have a drop down list with 3 entries.

    If you choose entry number 1, Lines 10 to 14 are hidden.
    If you choose entry number 2, Lines 15 to 29 are hidden and lines 10 to 14 are unhidden.
    If you choose entry number 3, Lines 20 to 25 are hidden and lines 10 to 29 are unhidden

    Until now i have the following:

    Private Sub Worksheet_Change(ByVal Target As Range)
            
            Rows("10:25").Select
            Selection.EntireRow.Hidden = False
            
        If Range("A1") = "1" Then
            Rows("10:14").Select
            Selection.EntireRow.Hidden = True
        ElseIf Range("A1") = "2" Then
            Rows("15:19").Select
            Selection.EntireRow.Hidden = True
        ElseIf Range("A1") = "3" Then
            Rows("20:24").Select
            Selection.EntireRow.Hidden = True
        End If
    End Sub

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address <> "$A$1" Or Target.Count > 1 Then Exit Sub
        Rows("10:25").EntireRow.Hidden = False
        Select Case Target.Value
            Case 1: Rows("10:14").EntireRow.Hidden = True
            Case 2: Rows("15:19").EntireRow.Hidden = True
            Case 3: Rows("20:24").EntireRow.Hidden = True
        End Select
    End Sub
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ 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. How do you get rid of blanks in a drop down list?
    By nerd999 in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 05-20-2014, 10:25 PM
  2. Assign Multiple Macros to Drop Down List
    By rme8223 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-21-2013, 01:17 PM
  3. Dynamic Drop Down List...with Criteria
    By TimE in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-17-2008, 11:43 AM
  4. Drop down list with sub list
    By schoenerNSC in forum Excel General
    Replies: 5
    Last Post: 02-09-2008, 08:05 PM
  5. Drop Down List Selections
    By Spencer in forum Excel General
    Replies: 3
    Last Post: 10-25-2007, 10:02 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