我有一个代码可以从文本框中搜索确切的值并突出显示但是我如何使其搜索部分字符串,例如包含3个字母或更多字母的值,并将它们作为搜索结果返回。
Sub search()
Dim i As Integer
Dim j As Integer
With UserForm1.ListBox1
.MultiSelect = fmMultiSelectSingle
.ListIndex = -1
.MultiSelect = fmMultiSelectMulti
For i = 0 To .ListCount - 1
For j = 0 To .ColumnCount - 1
If UserForm1.TextBox2.Text = .Column(j, i) Then
.ListIndex = i
.Selected(i) = True
End If
Next j
Next i
End With
End Sub
答案 0 :(得分:2)
尝试更改
var array = [1, 2, 3, 4];
var evens = _.remove(array, function(n) {
return n % 2 == 0;
});
console.log(array);
// → [1, 3]
console.log(evens);
// → [2, 4]
到
If UserForm1.TextBox2.Text = .Column(j, i) Then
答案 1 :(得分:1)
尝试:
If UserForm1.TextBox2.Text Like Left(.Column(j, i), 3) & "*" Then
这将比较字符串的前3个字符。