范围类别的自动过滤方法因“条件"而失败 [英] Auto filter method of range class failed with Criteria

查看:70
本文介绍了范围类别的自动过滤方法因“条件"而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Set rmdvsheet = ActiveWorkbook.Sheets(11)

    rmdvsheet.Range("A1:K103").AutoFilter Field:=10, Criteria1:= _
        "D7u L462-L494 17MY"

在第二行,我收到一条错误消息,提示范围类的自动筛选方法失败".

Here on 2nd line i am geting an error saying "Auto filter method of range class failed".

推荐答案

您的问题是您定义的范围.自动过滤器只希望引用标题行.如果将此内容包含在代码中,它将按您期望的方式工作(唯一的变化是在K103K1"的范围内):

Your problem is with the range you've defined. The autofilter only wants referral to the header row. If you sub this into your code, it should work the way you expect (the only change is in the range from K103 to K1"):

rmdvsheet.Range("A1:K1").AutoFilter Field:=10, Criteria1:="D7u L462-L494 17MY"

这篇关于范围类别的自动过滤方法因“条件"而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆