Try this one:
Option Explicit
Public Sub RetrieveData()
'Retrieves Range A2:A100 from DHR Report and pastes it in Specified Range on Dashboard
Dim SOURCE As Workbook 'workbook from where the data is to copied from
Dim SrcSheet As Worksheet
Dim DESTINATION As Worksheet 'workbook where the data is to be pasted to
Dim NextRow As Long
Dim ContractorCount As Long
Dim SourceArray() As Variant
Dim Contractor As Variant
'take off alerts to avoid Save As pop up
Application.ScreenUpdating = False
Set DESTINATION = ThisWorkbook.Sheets("destination") 'Dashboard
NextRow = DESTINATION.Range("A1").CurrentRegion.Rows.Count + 1
Set SOURCE = Workbooks.Open("C:\DOWNLOADS.NEW\DataSource(lougs7).xls")
Set SrcSheet = SOURCE.Sheets("source data")
ContractorCount = SrcSheet.Cells(Rows.Count, 1).End(xlUp).Row - 4
'copy the contactor names to an array and close the source file without saving
SourceArray = SrcSheet.Range("A5").Resize(rowsize:=ContractorCount).Value
SOURCE.Close False
For Each Contractor In SourceArray
DESTINATION.Cells(NextRow, 1).Value = Contractor
'copy the merged cell formats and paste to the last cell
DESTINATION.Cells(NextRow, 1).Offset(-5).Resize(5).Copy
DESTINATION.Cells(NextRow, 1).PasteSpecial Paste:=xlPasteFormats
NextRow = NextRow + 5 ' 5 merged cells
Next Contractor
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks