Thursday, January 19, 2012

Copy All Sheets Data Into One Sheet (VBA Program)

!....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

No comments:

Post a Comment

Excel VBA to send email from excel with HTML table in a email body

'' Excel vba script to send email from outlook & email body in HTML table format. ''Write down email body in HTML tags...