Consulting

Results 1 to 3 of 3

Thread: Apply AutoFilter based on selected cell in another sheet

  1. #1

    Apply AutoFilter based on selected cell in another sheet

    Hello,

    I am trying to create a VBA code to apply Auto Filter based on selected cell in another sheet (same workbook). I am not an expert, tried using vlookup function after creating a table of cell references. I am attaching sample file for reference.

    Request help from the experts in the group to guide on this.

    Thanks in advance!

    Vinay
    Attached Files Attached Files

  2. #2
    VBAX Expert
    Joined
    Sep 2016
    Posts
    788
    Location
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
        If Intersect(Target(1), Range("D7:H10")) Is Nothing Then Exit Sub
        
        Worksheets("sheet2").Activate
        With ActiveSheet.Range("D6").CurrentRegion
            .AutoFilter
            .AutoFilter Field:=1, Criteria1:=Cells(Target(1).Row, "D").Value
            .AutoFilter Field:=2, Criteria1:=Cells(6, Target(1).Column).Value
        End With
        
    End Sub

  3. #3
    Great! Thank you mana so much for your valuable help!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •