把所有工作表放入"d:data" ,工作表要求规范: 第一行:名称(在a列) 收入 发出 结存 统计数据在最后一行:cpu(在a列,不能为空) 120 50 70 新建一个表,拷贝下面代码到vba sub 多工作薄转换() awn = thisworkbook.name fm = inputbox("请输入软换文件所在的路经" & vbcrlf & vbcrlf & vbcrlf & vbcrlf & "如:", "提示", "d:data") set fs = createobject("scripting.filesystemobject") on error goto e1 set folders = fs.getfolder(fm) set files = folders.files for each file in files filename = right(file.name, 4) if filename = ".xls" or filename = ".xls" then on error goto e2 workbooks.open filename:=file sheets(1).copy before:=workbooks(awn).sheets(1) sheets(1).name = left(file.name, len(file.name) - 4) activesheet.range("2:" & activesheet.usedrange.rows.count - 1).delete shift:=xlup windows(file.name).close end if next set fs = nothing end e1: msgbox "输入路经有误!", , "提示" set fs = nothing end e2: msgbox "打开文件" & file & "出错!文件是否已经打开?", , "提示" set fs = nothing end end sub