+ Reply to Thread
Results 1 to 3 of 3

Apply filter on seleciton change event

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2013
    Location
    boston
    MS-Off Ver
    Excel 2010
    Posts
    79

    Apply filter on seleciton change event

    I have the following code that applies a filter after double clicking the cell in column A.
    Option Explicit
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
        Dim strIncid As String
        
        If ActiveCell.Column = 1 Then
            strIncid = ActiveCell.Value
            Sheets("DeepDive").Select
            Selection.AutoFilter Field:=2, Criteria1:=strIncid
            
        End If
        
    End Sub
    I am trying to perform the same action but with multiple selections and I am not sure how to get started. I am assuming that it would be in

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Any help would be great.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Apply filter on seleciton change event

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        If Target.Address = "$C$1" Then
            MsgBox "Do something here"
        End If
    
        If Target.Address = "$B$1" Then
            MsgBox "do something else here"
        End If
    
        If Target.Column = 1 Then
            Target.Offset(, 1) = "Yep"
        End If
    
    End Sub

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,523

    Re: Apply filter on seleciton change event

    If you wanted to filter by the target.value

        If Target.Column = 1 Then
               Sheets("DeepDive").Columns("B:B").AutoFilter Field:=1, Criteria1:=Target
        End If

+ 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. Event Calendar - Recurring event and filter
    By glnorton in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-01-2014, 07:57 PM
  2. [SOLVED] make filter automatically re-apply when cell values change
    By tlacloche in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 04-02-2013, 06:44 PM
  3. macro to filter (event change)
    By jw01 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2012, 05:21 PM
  4. [SOLVED] worksheet change event - filter issue
    By jw01 in forum Excel General
    Replies: 1
    Last Post: 04-05-2012, 02:50 AM
  5. Worksheet Change event ignore change event
    By jomili in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2011, 12:29 PM
  6. apply filter when value change cell
    By maba in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-23-2010, 04:52 AM
  7. Filter change triggers event?
    By ckiraly in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-26-2007, 03:54 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