I have written code to consolidate data from sheet1 up to one sheet before the last sheet and to paste these in sheet "Consolidated Data"
The data is copied and pasted from the respective sheets
I need my macro amended so that the data is pasted from row 2 onwards on sheet "Consolidated Data"
It would be appreciated if someone could amend my code accordingly
The data is copied and pasted from the respective sheets
I need my macro amended so that the data is pasted from row 2 onwards on sheet "Consolidated Data"
It would be appreciated if someone could amend my code accordingly
Code:
Sub Consolidated ()
Dim LR As Long
With Sheets("Consolidated Data")
LR = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A2:M").ClearContents
ShtCount = ActiveWorkbook.Sheets.Count
For i = 1 To ShtCount - 1
Worksheets(i).Activate
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row
Range("A2:P" & LastRow).Select
Selection.Copy
Sheets("Group Expenses").Activate
LastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Select
'Required after first paste to shift active cell down one
Do While Not IsEmpty(ActiveCell)
ActiveCell.Offset(1, 0).Select
Loop
Selection.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
.Range("A:M").EntireColumn.AutoFit
Next i
End With
End Sub