You should just be able to add this at the end of Macro1.
For Each ws In newWB.Worksheets
If ws.Name <> "Consolidated" Then
ws.Range("B32:B3032").Copy
newWB.Sheets("C").Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial xlValue
End If
Next ws
Mind you, instead of copying the worksheet from the workbooks you are opening you could just copy the range.
Option Explicit
Sub Macro1()
Dim sourceWb As Workbook, newWb As Workbook
Dim wsDst As Worksheet
Dim myPath As String, elem As Variant
Dim ctr As Integer, myArray As String
myPath = "C:\Users\bcourtney\Desktop\Data Consolidator\"
myArray = "C1,C2,C3,C4,C5,C6,C7,C8,C9,C10"
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each elem In Split(myArray, ",")
ctr = ctr + 1
Set sourceWb = Workbooks.Open(myPath & elem & ".csv")
If ctr = 1 Then
sourceWb.ActiveSheet.Copy
Set newWb = ActiveWorkbook
Set wsDst = newWb.Worksheets(1)
Else
sourceWb.ActiveSheet.Range("B32:B3032").Copy
wsDst.Cells(1, Columns.Count).End(xlToLeft).Offset(, 1).PasteSpecial xlValue
End If
sourceWb.Close False
newWb.Sheets(ctr).Name = CStr(elem)
Next
newWb.SaveAs Filename:=myPath & "Consolidated.xlsx"
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
PS Could you please add code tag? It was hard to see where one sub ended and the other started, tags would make that easier.
Oh, and I think adding code tags is kind of a rule too.
Bookmarks