[英]Excel VBA: 'excel vba run-time error 1004' application-defined or object-defined error
[英]run-time error '1004' application-defined or object-defined error VBA code
我的代碼中不斷出現此錯誤。 我進行了搜索,但沒有任何方法可以糾正這種情況。 我要嘗試做的就是在電子表格中鍵入3個輸入,從而允許用戶通過電子表格上的過濾器功能快速引用它們。 請有人幫忙
Sub Newnew()
Workbooks("CCP Quick Reference Guide.xls").Activate
Workbooks("CCP Quick Reference Guide.xls").Worksheets("Data").Select
'Dim xx As String
'Dim yy As String
'Dim zz As String
If Cells(3, 2).Value = "" Then
'Nothing
Else
xx = Cells(3, 2).Value
Range("A6").Select
Selection.AutoFilter
ActiveSheet.Range("$A$6:$I$1000").AutoFilter Field:=1, Criteria1:=xx
End If
If Cells(3, 3).Value = "" Then
'Nothing
Else
yy = Cells(3, 3).Value
Range("A6").Select
ActiveSheet.Range("$A$6:$I$1000").AutoFilter Field:=4, Criteria1:=yy
End If
If Cells(3, 4).Value = "" Then
'Nothing
Else
zz = Cells(3, 4).Value
Range("A6").Select
ActiveSheet.Range("$A$6:$I$1000").AutoFilter Field:=5, Criterial:=zz
End If
End Sub
在最后一個過濾器部分中,命名參數Criteria1
拼寫為Criterial
注意,最后一個字符應為數字1而不是字母l 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.