Results 1 to 7 of 7

Select multiple rows depending on value of A1

Threaded View

  1. #1
    Registered User
    Join Date
    03-23-2014
    Location
    Ottawa, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3

    Select multiple rows depending on value of A1

    Hi everyone
    Sorry for sounding a little too green behind the ears
    I have a spreadsheet with employees and data listed. The drop-down in A1 lets someone select the employee and then it hides the rows for all other employees. I want to add the names of supervisors in the drop-down of A1 and have it select only the employees under that supervisor and hide the rest. The number of employees under each supervisor ranges from 3 to 6. This is what I have to hide the rows when selecting a single employee :
    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim v As Variant, i, j As Long
        If Intersect(Target, Range("A1")) Is Nothing Then Exit Sub
        Application.ScreenUpdating = False
        Application.EnableEvents = False
        ActiveWindow.FreezePanes = False
    
        UsedRange.Rows.Hidden = False
        If IsEmpty(Cells(1, 1)) Then Exit Sub
        v = Cells(1, 1).Value
        For i = 2 To 40 ' Show/Hide the Analysts rows - Add/Substract to the second number when adding/removing analysts
            If Not Cells(i, 1) = v Then Rows(i).Hidden = True
            If v = "Select Analysts/Supervisors" Then Rows(i).Hidden = False
        Next i
    
    
        Cells(2, 1).Select
        ActiveWindow.FreezePanes = True
        Cells(2, 1).Select
        Application.EnableEvents = True
        Application.ScreenUpdating = True
    End Sub
    My workbook has stats data on the "Master" sheet(sheet #1) and analysts and supervisors on "Analysts" sheet(sheet #12). Data validation for cell A1 on "Master" sheet has all the analysts and supervisors in the first column of "Analysts" sheet with title "Select Analyst" in cell A1. I modified the "Analysts" sheet to show supervisors from B1:I1 and listed the analysts in the appropriate columns below them. Not sure how to make it select the analysts when someone selects the supervisor on "Master" sheet
    Last edited by Leith Ross; 03-23-2014 at 07:19 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Summing up and averaging multiple rows depending on week or month
    By Roxner in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 10-10-2013, 09:08 AM
  2. VBA Macro to hide rows depending on the cell value - Can I do this multiple times?
    By Ndocksey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 09:00 AM
  3. [SOLVED] Insert multiple rows depending on cell value
    By AR-51 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-03-2013, 04:18 AM
  4. Select rows depending on selection
    By Irprogram in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-08-2008, 04:12 AM
  5. Replies: 1
    Last Post: 04-23-2007, 04:23 PM

Tags for this Thread

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