我的宏将29301
输入到过滤器中,我想启动一个对话框,用户可以在其中输入自己的号码进行过滤。
Sub Macro3()
ActiveSheet.Range("$A$1:$CL$293662").AutoFilter Field:=19, Criteria1:= _
"=29301", Operator:=xlAnd
End Sub
答案 0 :(得分:1)
试一试。代码中的评论。
Public Sub test()
Dim retval
'Get a value, very simple input box
retval = InputBox("Please enter a number to filter by")
'Make sure the data is numeric
If IsNumeric(retval) = False Then
MsgBox "You didn't enter a number! Try again"
Exit Sub
End If
'Apply the filter
ActiveSheet.Range("$A$1:$CL$293662").AutoFilter Field:=19, Criteria1:="=" & retval
End Sub