hi,
i am using below code to filter table according to cell value
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Range("B1, C1, D1, F1, I1")) Is Nothing Then Exit Sub
Range("Table1[[#Headers],[CHQ NO]]").AutoFilter
If Target.Column = 2 Then
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=2, Criteria1:=Target
ElseIf Target.Column = 4 Then
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=4, Criteria1:=Target
ElseIf Target.Column = 3 Then
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=3, Criteria1:=Target
ElseIf Target.Column = 9 Then
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=9, Criteria1:=Target
ElseIf Target.Column = 6 Then
ActiveSheet.ListObjects("Table1").Range.AutoFilter Field:=6, Criteria1:="=*" & Target & "*"
End If
End Sub
Display More
in above code i need some changing.....
1 - what's wrong in above code is when i input data in cell separately B1, C1, D1, F1, I1, above code filtered data, now i delete the inputvalue from range then table is not going to unfiltered....it it filtring the "" also, i don't want to filter ""
2 - i need little improvement in above code is i want to filter data at once when i input data in above cell range
for example - i want to filter "harooon", in cell "I1", and i type in cell I1 ..."H" then it filter the all data with the value of "H" When i cancel the typed h then unfilter the table..
thanx