Skip to content

Instantly share code, notes, and snippets.

@Kyson
Created December 29, 2016 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kyson/dbe2c531b1fc6887df054b2acc1d192b to your computer and use it in GitHub Desktop.
Save Kyson/dbe2c531b1fc6887df054b2acc1d192b to your computer and use it in GitHub Desktop.
excel合并sheet
Sub hebing()
Dim FileOpen
Dim X As Integer
Application.ScreenUpdating = False
FileOpen = Application.GetOpenFilename(FileFilter:="Microsoft Excel文件(*.xlsx),*.xlsx", MultiSelect:=True, Title:="合并工作薄")
X = 1
While X <= UBound(FileOpen)
Workbooks.Open Filename:=FileOpen(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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment