|
本帖最后由 LMY123 于 2017-9-1 12:34 编辑
跨工作薄
http://club.excelhome.net/thread-971114-1-1.html
本工作薄
http://club.excelhome.net/thread-1221723-1-1.html
http://club.excelhome.net/forum. ... &tid=1352435&page=1
如何按标题行导入相应列数据-同薄多表.rar
(34.46 KB, 下载次数: 101)
补充内容 (2017-11-7 10:16):
http://club.excelhome.net/thread-1352435-2-1.html
SQL与字典方法
补充内容 (2017-11-22 15:41):
SQL跨工作薄:http://club.excelhome.net/forum. ... ead&tid=1289767
补充内容 (2017-11-22 15:47):
http://club.excelhome.net/forum. ... ertype=2&page=2
补充内容 (2017-11-22 16:23):
字典同薄:http://club.excelhome.net/thread-1250134-1-1.html
补充内容 (2018-1-27 11:17):
多薄单表的:http://club.excelhome.net/thread-1394629-1-1.html
补充内容 (2018-1-27 14:53):
同薄多表:http://club.excelhome.net/thread-898218-1-1.html
补充内容 (2018-3-22 15:40):
标题行有合并单元格
http://club.excelhome.net/forum. ... ead&tid=1402588
补充内容 (2018-8-18 17:22):
http://club.excelhome.net/forum. ... ead&tid=1431187
补充内容 (2018-12-13 17:44):
http://club.excelhome.net/thread-1451319-1-2.html
字典法
补充内容 (2018-12-23 21:50):
Sub 标题行相同_数据自动复制_字典法_多条件()
Set 字典 = CreateObject("scripting.dictionary")
条件1 = "债券卖出": 条件2 = "债券买入"
源数组 = Sheet1.Range("a1").CurrentRegion
条件数组 = Sheet2.Range("a1").CurrentRegion
ReDim 结果数组(1 To 20000, 1 To UBound(条件数组, 2))
For 列 = 1 To UBound(源数组, 2)
字典(源数组(1, 列)) = 列
Next 列
For 行 = 2 To UBound(源数组)
If 源数组(行, 10) = 条件1 Or 源数组(行, 10) = 条件2 Then
计数器 = 计数器 + 1
For 列 = 1 To UBound(条件数组, 2)
字典列 = 字典(条件数组(1, 列))
结果数组(计数器, 列) = 源数组(行, 字典列)
Next 列
End If
Next 行
Sheet2.Range("a2").Resize(计数器, UBound(结果数组, 2)) = 结果数组
End Sub |
|