Hi Peter
Try this tester
Header in A6:C6
Dates in A7:A1000
data in B7:C1000
We use A1:A2 for the criteria
A1= always empty
a2 = the code insert the formula in this cell
On the user form ListBox2 = years and ListBox2 = months
Note: numbers and not Jan, Feb
If you want that you can use the index
The try this button on the userform
Private Sub CommandButton1_Click()
Range("A2").Formula = "=AND(YEAR(A7)= " & Me.ListBox2.Value & ",MONTH(A7)=" & Me.ListBox1.Value & ")"
Range("A6:C1000").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:= _
Range("A1:A2"), Unique:=False
End Sub
--
Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm
"Peter" wrote in message oups.com...
The operator selects the month and the year from 2 list boxes on a
userform.
This is then turned into two variables.
I hope this makes sense, and thanks again!