• 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

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

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
 
Back
Top