Skip to content

Instantly share code, notes, and snippets.

@NixonInnes
Created May 20, 2015 10:32
Show Gist options
  • Save NixonInnes/f1e279a9a9e74cb4ca36 to your computer and use it in GitHub Desktop.
Save NixonInnes/f1e279a9a9e74cb4ca36 to your computer and use it in GitHub Desktop.
[Excel] Combines all Worksheets into a new Worksheet
Sub CombineSheets()
Dim I As Integer
On Error Resume Next
Sheets(1).Select
Worksheets.Add
Sheets(1).Name = "Combined"
Sheets(2).range("A1").EntireRow.Select
Selection.Copy Destination:=Sheets(1).range("A1")
For I = 2 To Sheets.Count
Sheets(I).Activate
range("A1").Select
Selection.CurrentRegion.Select
Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select
Selection.Copy Destination:=Sheets(1).range("A65536").End(xlUp)(2)
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment