• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Data Filter

sambit

Member
Dear Sir,
I have a data from Range E5: H11. I want to filter Invoice No as per E2 Cell. If I delete Invoice No from E2 cell then data became original Form.

Please find the example file for your reference.
 

Attachments

  • Example.xlsx
    12.1 KB · Views: 3
May be this?

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False

With Sheet1
   
    On Error Resume Next
    .ShowAllData
    i& = .Cells(Rows.Count, 1).End(xlUp).Row
    If Not Intersect(ActiveCell, .Range("A2:A2")) Is Nothing Then
        If .[A2] <> vbNullString Then
            .Range("A4:H" & i).AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
            .Range("A1:A2"), Unique:=False
        ElseIf .[A2] = vbNullString Then .ShowAllData
        End If

    End If

End With

Application.ScreenUpdating = True
End Sub
 

Attachments

  • Example.xlsb
    16.8 KB · Views: 2
Nebu Sir,
Thanks for your reply. I don't want to choose Invoice No in combo box (Cell "A2"). I'll type manually Invoice No in the above cell i.e, A2
 
Nebu Sir,
After removing the data validation, it does not work.

Example-1 file is attached for your kind information.
 

Attachments

  • Example-1.xlsb
    15.3 KB · Views: 1
Back
Top