i have a code to consolidate the all sheet into one.
sheet name is consolidate. but whenever i have running this, data copying twice.
please help.
sheet name is consolidate. but whenever i have running this, data copying twice.
Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Sheets("One").Range("a1:c1").Copy Sheets("consolidate").Range("a1:c1")
For Each sh In ActiveWorkbook.Worksheets
If sh.Name <> "consolidate" Then
With sh
a = .UsedRange.Offset(1)
Sheets("consolidate").Range("a" & Sheets("consolidate").Cells(Rows.Count, 1).End(xlUp).Row + 1) _
.Resize(UBound(a, 1), UBound(a, 2)) = a
Cells(1, 1).Select
End With
End If
Next sh
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
please help.