如何将过滤范围复制到数组中?(Excel VBA) [英] How do I copy a filtered range into an array? (Excel VBA)

查看:61
本文介绍了如何将过滤范围复制到数组中?(Excel VBA)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此公式将唯一记录从 A 列复制到 B 列.

I use this formula to copy unique records from Column A into Column B.

Range("A1", Range("A100").End(xlUp)).AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range("B1"), Unique:=True

如何将过滤后的结果放入 Excel VBA 中的数组中,而不是将其复制到 B 列中?

Instead of copying it into Column B how do you put the filtered results into an array in Excel VBA?

推荐答案

您需要 阅读此内容,它将为您指明正确的方向

You will want to Read this and it will point you in the right direction

它说:

  1. 使用 AdvancedFilter 方法在工作表的一些未使用区域创建过滤范围
  2. 将该范围的 Value 属性分配给 Variant 以创建二维数组
  3. 使用该范围的 ClearContents 方法来摆脱它

这篇关于如何将过滤范围复制到数组中?(Excel VBA)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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