Good morning. I am using the following VBA to take data from multiple workbooks and copy into one master. It works, but it takes ages as I have to watch each of the workbooks open and then go through the copying of data and pasting into the master. Is there a way that I can put in additional code to stop me from seeing this and also to maybe speed up the whole consolidation process?
Sub consolidate()
Dim wb As Workbook, sh As Worksheet, fPath As String, fName As String
fPath = "M:\Business Change - Projects\PMO\JAMES - TEST\Demand Management\Resource Forecasts\"
fName = Dir(fPath & "*.xl*")
Do While fName <> ""
Set wb = Workbooks.Open(fPath & fName)
Set sh = wb.Sheets("FORECAST")
If Application.CountA(ThisWorkbook.Sheets(1).Rows(6)) = 0 Then
sh.UsedRange.Offset(5).Copy ThisWorkbook.Sheets(1).Range("A6")
Else
sh.UsedRange.Offset(5).Copy ThisWorkbook.Sheets(1).Cells(Rows.Count, 1).End(xlUp)(2)
End If
wb.Close False
fName = Dir
Loop
End Sub[/B]
Bookmarks