Created
May 20, 2015 10:32
-
-
Save NixonInnes/f1e279a9a9e74cb4ca36 to your computer and use it in GitHub Desktop.
[Excel] Combines all Worksheets into a new Worksheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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