Excel VBA筛选和复制粘贴数据 [英] Excel VBA filtering and copy pasting data

查看:1365
本文介绍了Excel VBA筛选和复制粘贴数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给出一个数据集,可以说10列.在A列中,我有日期,在B列中,我有%.我只想过滤A列2014年数据和B列<70%,然后将过滤后的数据复制粘贴到另一个工作表中.我该如何为下一行编写代码以到达过滤数据的第一行?

Given a data set, that is lets say 10 columns. In column A i have date and in column B i have %. I want to filter for column A only 2014 data and for column B <70% and copy paste the filtered data into another worksheet. How do i go about writing the code for the next line to get to the first row of filtered data?

ActiveSheet.Range("$A$1:$AR$1617").AutoFilter Field:=5, Operator:= _
xlFilterValues, Criteria2:=Array(0, "12/28/2014")
ActiveSheet.Range("$A$1:$AR$1617").AutoFilter Field:=14, Criteria1:="<0.7" _
        , Operator:=xlAnd

推荐答案

使用Offset这样的方法:

ActiveSheet.Range("A1:AR1617").Offset(1, 0).SpecialCells(xlCellTypeVisible).Copy 

以上代码将复制过滤后的数据(不包括标题).
这是您要尝试的吗?

Above code copies the filtered data excluding the header.
Is this what you're trying?

这篇关于Excel VBA筛选和复制粘贴数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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