Excel VBA 字典/数组 示例
来源:互联网 发布:易建联在雄鹿数据 编辑:程序博客网 时间:2024/05/01 15:03
A 将数组作为字典的ValuePrivate Sub CommandButton3_Click()Dim arr, arr1, i&, d As Objectarr = Sheets(3).[a1].CurrentRegionarr1 = [a1].CurrentRegionSet d = CreateObject("scripting.dictionary")For i = 2 To UBound(arr) d(arr(i, 1)) = ""Next iFor i = 2 To UBound(arr1) If d.exists(arr1(i, 1)) Then d(arr1(i, 1)) = Array("", arr1(i, 3), "", arr1(i, 5), arr1(i, 6))Next iSheets(3).[b2].Resize(d.Count, UBound(arr, 2) - 1) = Application.Transpose(Application.Transpose(d.items))End SubB法Private Sub CommandButton1_Click()arr = [a1].CurrentRegionSet d = CreateObject("scripting.dictionary")For i = 2 To UBound(arr) d(arr(i, 1)) = iNext ibrr = Sheet3.Range("a1").CurrentRegionFor i = 2 To UBound(brr) n = d(brr(i, 1)) brr(i, 3) = arr(n, 3) brr(i, 5) = arr(n, 5) brr(i, 6) = arr(n, 6)NextSheet3.Range("a1").CurrentRegion = brrEnd Subc = Array(3, 5, 6)For i = 2 To UBound(brr) n = d(brr(i, 1)) For j = 0 To 2 brr(i, c(j)) = arr(n, c(j)) NextNext原贴http://club.excelhome.net/thread-1057654-1-1.htmlhttp://club.excelhome.net/thread-698873-1-1.html
0 0
- Excel VBA 字典/数组 示例
- VBA Excel宏操作示例
- Excel VBA - 数组及其他知识
- Excel VBA真正的动态数组实例
- excel vba真正的动态数组实例
- [Excel VBA]如何拷贝数组?
- Excel VBA将某列数值存入一个数组
- Excel VBA练习:字典类型与正则表达式的使用
- excel VBA 字典与集合(Dictionary与Collection)
- VBA示例
- 使用 Excel 2003 工作表的 VBA 示例
- 使用 Excel 2003 工作表的 VBA 示例
- Excel VBA Range对象基本操作应用示例
- 使用 Excel 2003 工作表的 VBA 示例 (From MSDN)
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- acm1005题
- CMAKE error
- 浮点数加法
- 润乾在jetty应用服务器下的JNDI配置一
- iOS开发---如何查看iPhone手机的UUID
- Excel VBA 字典/数组 示例
- C++ const关键字的使用知识点总结
- 熄灯问题 - 详解
- Qt 原子操作的类QAtomicInteger
- visual studio 2015 对电脑配置有什么要求啊,比如内存 多少Ghz win几?等
- bzoj 1911
- RPC框架性能基本比较测试
- 【caffe-Windows】的Python接口配置
- 脑袋开花