天天看點

多個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

繼續閱讀