我的代码中遇到了问题。
搜索时,它只搜索小写值。但是我希望它搜索值是大写还是小或混合。
这是我的代码。
Private Sub CommandButton1_Click()
Dim intValueToFind As String
Dim ws As Worksheet, tbl As ListObject, rng As Range
Set ws = Sheets("Sheet1")
Set tbl = ws.ListObjects(Me.ComboBox1.Value)
Set rng = tbl.ListColumns(1).DataBodyRange
intValueToFind = Me.TextBox3.Value
For Each rng In rng ' Revise the 500 to include all of your values
If LCase(rng.Value) = intValueToFind Then
MsgBox ("Found value on row " & rng.Value)
Exit Sub
End If
Next rng
' This MsgBox will only show if the loop completes with no success
MsgBox ("Value not found in the range!")
End Sub
请审核并告知我如何才能获得我需要的解决方案......
由于 萨勒曼