关于筛选问题的Excel VBA错误424

时间:2018-08-28 09:47:47

标签: excel vba excel-vba

非常棒的StackOverflow用户, 我创建了一个文本框来搜索Excel VBA中的信息范围。我使用函数过滤器进行搜索,但是当我在文本框中键入内容时,出现错误“ 424”。我该怎么办?这是下面的代码。内容是工作表的名称,该工作表包含一组需要过滤的数据。

Private Sub TextBox1_Change()

If Len(TextBox1.Value) = 0 Then
Content.AutoFilterMode = False
Else
If Content.AutoFilterMode = True Then
Content.AutoFilterMode = False
End If
Content.Range("T11:W" & Rows.count).AutoFilter field:=1, Criterial:="*" & TextBox1.Value & "*"
End If
End Sub

0 个答案:

没有答案