Hi All. Basically I created a macro by searching online however it is not following the <> rule and instead copies from all sheets so I need help to fix it. Thanks in advance.
Code
Sub Consolidate_Data()
'Set my own sheet list array
Dim MyArray As Variant
MyArray = Array("Consolidated", "Home", "ACL Sheet", "Doc info", "Active Pending", "database")
'main macro copying unknown x number of sheets and unknown length range
For Each ws In Worksheets
If ws.Name <> "MyArray" Then
ws.Range("A2:P" & ws.Range("A" & Rows.Count).End(xlUp).Row).Copy
Worksheets("Consolidated").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial (xlPasteValues)
End If
Next ws
'go back to top
Worksheets("Consolidated").Select
Range("A1").Select
End Sub
Display More