Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 2082|回复: 1

[已解决]请教:按多条件提取指定工作簿的指定数据

[复制链接]
发表于 2015-7-30 16:07 | 显示全部楼层 |阅读模式
本帖最后由 海水鱼 于 2015-7-30 20:45 编辑

请看:附件,谢谢!
最佳答案
2015-7-30 16:40
  1. Sub Macro1()
  2. On Error Resume Next
  3. Application.ScreenUpdating = False
  4. mypath = ThisWorkbook.Path & "\基础数据": h = [b2]
  5. For i = 3 To Range("a65536").End(xlUp).Row
  6.     With GetObject(mypath & Cells(i, 1) & ".xls")
  7.         .Sheets(1).Cells(h, 1).Resize(1, 200).Copy Cells(i, 2)
  8.         .Close 0
  9.     End With
  10. Next
  11. Application.ScreenUpdating = True
  12. End Sub
复制代码

按多条件提取指定工作簿的指定数据.zip

25.67 KB, 下载次数: 13

发表于 2015-7-30 16:40 | 显示全部楼层    本楼为最佳答案   
  1. Sub Macro1()
  2. On Error Resume Next
  3. Application.ScreenUpdating = False
  4. mypath = ThisWorkbook.Path & "\基础数据": h = [b2]
  5. For i = 3 To Range("a65536").End(xlUp).Row
  6.     With GetObject(mypath & Cells(i, 1) & ".xls")
  7.         .Sheets(1).Cells(h, 1).Resize(1, 200).Copy Cells(i, 2)
  8.         .Close 0
  9.     End With
  10. Next
  11. Application.ScreenUpdating = True
  12. End Sub
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-3-29 23:17 , Processed in 0.614555 second(s), 10 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表