PDA

View Full Version : Filter worksheet data as per the value selected in Validation Listbox



aalokwar
10-26-2010, 10:48 PM
I want to filter worksheet data as per the value selected in Validation Listbox.
I have attached excel sheet for reference.

CharlesH
11-07-2010, 01:22 PM
Hi,

Try the following code. Place it in the sheet code module.You may need to change the sheet names to your sheet name.
Each time you make a selection it should reset the filter.


Private Sub Worksheet_Change(ByVal target As Range)
Application.ScreenUpdating = False
Dim Mycol As Integer, Myrow As Integer
Mycol = target.Column
Myrow = target.Row
If Mycol = 1 And Myrow = 2 Then
Application.DisplayAlerts = False
Sheets("Sheet1").Range("A4").AutoFilter
Sheets("Sheet1").Range("A4").AutoFilter Field:=1, Criteria1:=Range("A2")
Application.DisplayAlerts = True
End If

End Sub

mdmackillop
11-07-2010, 03:36 PM
Try this. It uses dynamic range names as the Criteria source and Filter area.

Chandrasheka
11-10-2010, 05:22 AM
Thank you