简体   繁体   中英

Use VBA to filter value equal or greater than TextBox.value

I need to filter the Column E to show only results equal or greater than TextBox.Value

So far I have the code to filter if the value is exact match to TextBox.Value, I have tried also something like this: sh.Range("$E$2:$E$11").AutoFilter Field:=5, Criteria1:=">=A" but does'n work.

Private Sub TextBox_Change()
If Me.TextBox.Value <> "" Then
Dim sh As Worksheet
Set sh = ActiveSheet
Dim A As Long

A = Me.TextBox.Value

sh.Range("$E$2:$E$11").AutoFilter Field:=5, Criteria1:=A
End If
End Sub

Variables don't belong inside quotes. Use the & to concatenate:

Criteria1:=">=" & A

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM