+ Reply to Thread
Results 1 to 7 of 7

Hide rows based on drop down list

Hybrid View

  1. #1
    Registered User
    Join Date
    01-10-2016
    Location
    Gunnedah, Australia
    MS-Off Ver
    2007
    Posts
    5

    Hide rows based on drop down list

    Hi guys,

    I'm creating a basic sales tracking spreadsheet for a consultancy I'm working for. All new jobs (or BD opportunities) are added to the spreadsheet and a status is assigned to the job (Positioning, Pursuit, Proposal, Closed, Won or Lost).

    I want to display entries for a given status only based on a drop down list. i.e. if the user selects "Positioning" from the drop down list, only jobs marked as "Positioning" will be shown. All other rows will be hidden. I know this can't be too hard, but it's been a while since I've played with VBA.

    I've put together a basic example but can't work out how to attach it...

    Thanks in advance!
    Last edited by soco3594; 04-12-2017 at 02:55 AM.

  2. #2
    Forum Expert
    Join Date
    08-12-2012
    Location
    Sydney, Australia
    MS-Off Ver
    Excel 2010
    Posts
    5,636

    Re: Hide rows based on drop down list

    try one of these methods
    https://www.excelforum.com/the-water...his-forum.html
    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

  3. #3
    Registered User
    Join Date
    01-10-2016
    Location
    Gunnedah, Australia
    MS-Off Ver
    2007
    Posts
    5

    Re: Hide rows based on drop down list

    Thanks! Demo file attached

    Sales Tracker - Demo.xlsx

  4. #4
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: Hide rows based on drop down list

    My apologies....Change event code...source:Experts Exchange
    Option Explicit
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim row As Double
    Dim hide As Boolean
        If Target.Address = "$D$2" Then
            For row = 5 To UsedRange.Rows.Count
                hide = True
                If Cells(row, 3) = Target Then hide = False
                    Rows(row).Hidden = hide
            Next row
        End If
    End Sub
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  5. #5
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: Hide rows based on drop down list

    Hi soco3594
    Option Explicit
    Sub HideMe()
    Dim lrow As Long
    Dim i As Integer
    Dim ws As Worksheet
    Set ws = Sheets("Jobs")
    lrow = ws.Cells(Rows.Count, "C").End(xlUp).Row
    With ws
    For i = 5 To lrow
        If .Cells(i, 3) <> .Range("D2").Text Then
            .Cells(i, 3).EntireRow.Hidden = True
        End If
    Next i
    End With
    End Sub

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,834

    Re: Hide rows based on drop down list

    To "Jobs" sheet code module.
    Private Sub Worksheet_Change(ByVal Target As Range)
        If (Target.Address(0, 0) <> "D2") Then Exit Sub
        With [a4].CurrentRegion
            .Parent.AutoFilterMode = False
            If Target.Value <> "" Then .Columns(3).AutoFilter 1, Target.Value, , , VisibleDropDown:=False
        End With
    End Sub
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-10-2016
    Location
    Gunnedah, Australia
    MS-Off Ver
    2007
    Posts
    5

    Re: Hide rows based on drop down list

    Thanks guys!

+ 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 rows based on muti cell drop down list
    By prat33 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-06-2017, 09:32 PM
  2. Drop Down List value to Hide Rows
    By rabbit8 in forum Excel General
    Replies: 5
    Last Post: 04-15-2014, 01:00 AM
  3. Hide-Unhide rows on multiple worksheets based on value of a drop down list
    By clo2peter in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-10-2014, 08:32 AM
  4. [SOLVED] hide or unhide rows based on text within a drop down list
    By souimet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 01:32 AM
  5. [SOLVED] VBA code to hide/unlide rows based on drop down list
    By evakotsi in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-03-2012, 10:30 PM
  6. [SOLVED] Macro Filter to hide rows based on Drop Down List
    By dieseldogpi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2012, 11:19 AM
  7. Hide Rows based on Client Drop Down List
    By troyhalsey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2012, 07:28 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