PDA

View Full Version : [SOLVED:] VBA filter



GosiaHali
06-14-2016, 05:10 AM
Hi, I have a question: I want to filter the data in tabel, however my code doesnt work, could you help me how to fix it:

Private Sub Makro()
Dim t As Integer
t = InputBox("Number: ")
Cells.Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$11").AutoFilter Field:=5, Criteria1:=">t", _
Operator:=xlAnd

End Sub

mdmackillop
06-14-2016, 06:00 AM
Syntax error in your criteria.


Private Sub Makro()
Dim t As Integer
t = InputBox("Number: ")
ActiveSheet.Range("$A$1:$E$11").AutoFilter Field:=5, Criteria1:=">" & t
End Sub

GosiaHali
06-14-2016, 06:09 AM
Still shows nothing after filtering, seems like it doesnt read t as a value

GosiaHali
06-14-2016, 06:10 AM
ok it works now !!! thank you !