Created
March 31, 2020 17:40
-
-
Save dude333/0a9263c67aae2ee982ad102dec0ef7e3 to your computer and use it in GitHub Desktop.
Revisions
-
dude333 created this gist
Mar 31, 2020 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ ' Source: https://excel.tips.net/T003005_Condensing_Multiple_Worksheets_Into_One.html Sub Combine() Dim J As Integer On Error Resume Next Sheets(1).Select Worksheets.Add ' add a sheet in first place Sheets(1).Name = "Combined" ' copy headings Sheets(2).Activate Range("A1").EntireRow.Select Selection.Copy Destination:=Sheets(1).Range("A1") ' work through sheets For J = 2 To Sheets.Count ' from sheet 2 to last sheet Sheets(J).Activate ' make the sheet active Range("A1").Select Selection.CurrentRegion.Select ' select all cells in this sheets ' select all lines except title Selection.Offset(1, 0).Resize(Selection.Rows.Count - 1).Select ' copy cells selected in the new sheet on last line Selection.Copy Destination:=Sheets(1).Range("A65536").End(xlUp)(2) Next End Sub