简体   繁体   English

运行时错误'1004-Range类的AutoFilter方法失败

[英]Run-Time error '1004 - AutoFilter method of Range class failed

I am getting the above error when running the below code. 运行以下代码时出现上述错误。 I am very new to VBA and need some assistance in debugging. 我是VBA的新手,需要调试方面的帮助。

Sub TransferTest1()

Dim INQUIRE As Worksheet
Dim QUOTE As Worksheet
Dim ORDER As Worksheet
Dim YString As String
Dim RecString As String

Set INQUIRE = ActiveWorkbook.Sheets("Inquiries")
Set QUOTE = ActiveWorkbook.Sheets("Quotes")
Set ORDER = ActiveWorkbook.Sheets("Orders")

With INQUIRE.Range("A6:K1200")
    .AutoFilter 11, "Y"
    .Offset(1).Resize(, 7).Copy QUOTE.Range("A6")  ' columns A:G
    .AutoFilter
End With

With QUOTE.Range("A6:N1200")
    .AutoFilter 14, "Rec'vd"
    .Offset(1).Resize(, 7).Copy ORDER.Range("A6") ' columns A:G
    .Offset(1).Resize(, 2).Offset(11).Copy ORDER.Range("K6")  ' columns L:M
    .AutoFilter
End With

End Sub

Thank you for the help in advance! 预先感谢您的帮助!

R. Smithey 史密斯

Precede each call to .AutoFilter with, 在每次调用.AutoFilter

if .parent.autofiltermode then .parent.autofiltermode = false

This will turn off any pre-existing .AutoFilters if they exist and do nothing if they do not exist. 如果存在的话,这将关闭所有现有的.AutoFilters,如果不存在,则不执行任何操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行时错误“1004”:范围类的自动过滤方法失败 - run-time error '1004': Autofilter method of range class failed 运行时错误1004 - 范围类的自动过滤方法失败 - Run-time error 1004 - Autofilter Method of Range Class Failed 运行时错误“1004”--范围类的自动过滤方法失败 - Run-time Error '1004'-- AutoFilter Method of Range Class Failed 运行时错误:Range AutoFilter上的'1004' - Run-time error: '1004' on Range AutoFilter 运行时错误'1004:范围类的小计方法失败 - Run-time error '1004: Subtotal method of range class failed 运行时错误'1004:范围 class 的 PasteSpecial 方法失败 - Run-time error '1004: PasteSpecial method of Range class failed 运行时错误'1004':Range类的PasteSpecial方法失败 - Run-time error '1004': PasteSpecial method of Range class failed VBA:为什么自动过滤器在手动过滤器时不起作用? (运行时错误'1004':对象'Range'的方法'AutoFilter'失败) - VBA: Why will Autofilter not work when manual filter does? (Run-time error '1004': Method 'AutoFilter' of object 'Range' failed) 错误信息 Run time error 1004 Autofilter method or range class failed - Error message Run time error 1004 Autofilter method or range class failed 录制的 VBA 宏 - 运行时错误 1004 范围类的自动过滤方法失败 - Recorded VBA macro - run time error 1004 autofilter method of range class failed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM