Drop down list for the criteria range of the filter function

MrRobinson

New Member
Joined
Jun 23, 2008
Messages
3
hello all,

I have created a VBA code which will automatically filter the "database" sheet and paste the filtered data on another sheet and finally sort ascending the last column of the filtered data. This is the code :

Private Sub SpinButton1_Change()
ActiveWindow.DisplayVerticalScrollBar = True


End Sub

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A4:F4")) Is Nothing Then
Dim DataSH As Worksheet
Set DataSH = Sheets("Database")
DataSH.Range("A:M").AdvancedFilter action:=xlFilterCopy, copytorange:=Range("A9:M9"), criteriarange:=Range("A3:F4")
Range("A10:J500").Sort Key1:=Range("J10"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, SortMethod _
:=xlStroke, DataOption1:=xlSortNormal
End If
End Sub

However i want to create a drop down list on each column of the criteria range. Therefore i can choose the options in the lists instead of typing them.

I have try to create the combo box but it will list out all the options and repeat the same options. How can i make the list to only list out the options without repeating? Because the database will be updated from time to time, therefore i have to make it automatically remove the duplicated options in the drop down list instead of manually remove it.



Can anyone help me out with this? Thanks:)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,215,477
Messages
6,125,031
Members
449,205
Latest member
Eggy66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top