天天看点

多个Excel 合并成1个文档

sub 多表多文件合并为多表一文件()

dim filearray

dim x as integer

application.screenupdating = false

filearray = application.getopenfilename(filefilter:="microsoft excel文件(*.xlsx),*.xlsx", multiselect:=true, title:="合并工作薄")

x = 1

while x <= ubound(filearray)

workbooks.open filename:=filearray(x)

sheets().move after:=thisworkbook.sheets(thisworkbook.sheets.count)

x = x + 1

wend

exithandler:

application.screenupdating = true

exit sub

errhadler:

   msgbox err.description

end sub

继续阅读