如何从100多个excel文件中提取相同位置的数据,然后按行排列到一个工作表中?急需帮助,多谢。
1个回答
2013-11-21
展开全部
以下vbs代码,把代码ReDim s(WScript.Arguments.Count-1)
Dim oExcel,oWb,oSheet,Ws
Set oExcel = CreateObject("excel.application")
Set Ws = CreateObject("wscript.Shell")
For i=0 To WScript.Arguments.Count-1
Set oWb=oExcel.Workbooks.Open(WScript.Arguments(i))
Set oSheet=oWb.Sheets("Sheet1")
s(i)=oSheet.range("C5")
oWb.Close
Ws.Run "cmd.exe /c echo " &s(i)&" >>d:\结果.xls",0
Next
Dim oExcel,oWb,oSheet,Ws
Set oExcel = CreateObject("excel.application")
Set Ws = CreateObject("wscript.Shell")
For i=0 To WScript.Arguments.Count-1
Set oWb=oExcel.Workbooks.Open(WScript.Arguments(i))
Set oSheet=oWb.Sheets("Sheet1")
s(i)=oSheet.range("C5")
oWb.Close
Ws.Run "cmd.exe /c echo " &s(i)&" >>d:\结果.xls",0
Next
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询