Sub CopyRanges()
Application.ScreenUpdating = False
Dim lColumn As Long, lastRow As Long, x As Long
Dim desWB As Workbook, srcWB As Workbook, desWS As Worksheet
Set srcWB = ActiveWorkbook
Set desWB = Workbooks.Open("X:\CMC\MINE\MINEPLAN\Development Projects\2018 Dev.Projects\Luce Phase E - Stage 2\9.Reports\1. Daily Production Report\ProductionReport Master.xlsm")
Set desWS = desWB.Sheets("Sheet1")
With srcWB.Sheets("Haul")
lastRow = desWS.Range("A" & desWS.Rows.Count).End(xlUp).Row
If lastRow = 1 And Range("A1") = "" Then
.Range("F34:F37").Copy
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("H4:H36").Copy
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("L34:L36").Copy
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("N34").Copy desWS.Cells(lastRow, lColumn)
Else
lastRow = desWS.Range("A" & desWS.Rows.Count).End(xlUp).Row + 1
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column
.Range("F34:F37").Copy
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("H4:H36").Copy
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("L34:L36").Copy
desWS.Cells(lastRow, lColumn).PasteSpecial Transpose:=True
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("N34").Copy desWS.Cells(lastRow, lColumn)
End If
End With
With srcWB.Sheets("Drills")
lastRow = desWS.Range("A" & desWS.Rows.Count).End(xlUp).Row
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("E30:K30").Copy desWS.Cells(lastRow, lColumn)
End With
With srcWB.Sheets("Fuel")
lastRow = desWS.Range("A" & desWS.Rows.Count).End(xlUp).Row
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("F10:H10").Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("F21:H21").Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("F45:H45").Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("F60:H60").Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
.Range("F74:H74").Copy desWS.Cells(lastRow, lColumn)
End With
With srcWB.Sheets("Personnel")
lastRow = desWS.Range("A" & desWS.Rows.Count).End(xlUp).Row
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
For x = 10 To 18
.Range("C" & x).Resize(, 2).Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
Next x
For x = 10 To 18
.Range("F" & x).Resize(, 2).Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
Next x
For x = 10 To 18
.Range("I" & x).Resize(, 2).Copy desWS.Cells(lastRow, lColumn)
lColumn = desWS.Cells(lastRow, desWS.Columns.Count).End(xlToLeft).Column + 1
Next x
End With
Application.ScreenUpdating = True
End Sub