!....VBA Program to Copy All the Data in the Activeworkbook & Paste into One Sheet....!
Sub Copy_Allsheets_Data()
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Consolidate Sheet"
For i = 1 To Sheets.Count - 1
Sheets(i).Select
Range("a1", Range("a1").SpecialCells(xlCellTypeLastCell)).Copy
If Sheets("Consolidate Sheet").Range("a1") = "" Then
Sheets("Consolidate Sheet").Range("a1").PasteSpecial xlPasteValues
Else
Sheets("Consolidate Sheet").Select
Cells(Range("a1048576").End(xlUp).Row + 2, 1).PasteSpecial xlPasteValues
End If
Next
End Sub
Sub Copy_Allsheets_Data()
Sheets.Add(after:=Sheets(Sheets.Count)).Name = "Consolidate Sheet"
For i = 1 To Sheets.Count - 1
Sheets(i).Select
Range("a1", Range("a1").SpecialCells(xlCellTypeLastCell)).Copy
If Sheets("Consolidate Sheet").Range("a1") = "" Then
Sheets("Consolidate Sheet").Range("a1").PasteSpecial xlPasteValues
Else
Sheets("Consolidate Sheet").Select
Cells(Range("a1048576").End(xlUp).Row + 2, 1).PasteSpecial xlPasteValues
End If
Next
End Sub
No comments:
Post a Comment