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

查看:202
本文介绍了如何将过滤范围复制到数组中? (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

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

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天全站免登陆