EXCEL合并工作表宏代码.pptxVIP

  • 7
  • 0
  • 约小于1千字
  • 约 1页
  • 2020-10-10 发布于广东
  • 举报
Sub CombineWorkbooks() Dim FilesToOpen Dim x As IntegerOn Error GoTo ErrHandlerApplication.ScreenUpdating = FalseFilesToOpen = Application.GetOpenFilename(FileFilter: = MicroSoft Excel 文 件(*.xls),*.xls,MultiSelect: = True,Title: = 要合并的文件) If TypeName(FilesToOpen) = Boolean thenMsgBox 没有选中文件Goto ExitHandler end ifx = 1While x = UBound(filestoopen)Workbooks.Open fileName: = filestoopen(x)Sheets().Move After: = ThisWorkbook.Sheets (ThisWorkbook.Sheets.Count) x = x + 1Wend ExitHandler:Application.ScreenUpdating = True Exit SubErrHandler:MsgBox Err.Description Resume ExitHandlerEnd Sub1

文档评论(0)

1亿VIP精品文档

相关文档