strongman86
Board Regular
- Joined
- Feb 15, 2017
- Messages
- 115
- Office Version
- 2019
- Platform
- Windows
Hi guys,
I got this code working, but I need to add another worksheet which code would ignore (sheet called "Data"). Can you please fix code:
I got this code working, but I need to add another worksheet which code would ignore (sheet called "Data"). Can you please fix code:
VBA Code:
Sub Consolidate()
Dim arr() As Variant
Dim ws As Worksheet
Dim wMast As Worksheet
Dim x As Long
Dim y As Long
Set wMast = Sheets("master")
Application.ScreenUpdating = False
For Each ws In ActiveWorkbook.Worksheets
With ws
If .Name <> wMast.Name Then
x = .Cells(.Rows.Count, 25).End(xlUp).Row
y = .Cells(x, .Columns.Count).End(xlToLeft).Column
arr = .Cells(x, 1).Resize(, y).Value
wMast.Cells(Rows.Count, 1).End(xlUp).Offset(1).Resize(, UBound(arr, 2)).Value = arr
Erase arr
End If
End With
Next ws
Application.ScreenUpdating = True
Set wMast = Nothing
End Sub