Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi, good morning, i have the code below but i was wondering if there was anything that could be done to make it abit more compact? also is there anyway to stop the pop up of the file?
Code:
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim lookuprng As Range
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("C1").Copy wb1.Sheets("ROTA").Range("B2:B27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("D1").Copy wb1.Sheets("ROTA").Range("D2:D27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("E1").Copy wb1.Sheets("ROTA").Range("F2:F27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("F1").Copy wb1.Sheets("ROTA").Range("H2:H27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("G1").Copy wb1.Sheets("ROTA").Range("J2:J27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("H1").Copy wb1.Sheets("ROTA").Range("L2:L27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("I1").Copy wb1.Sheets("ROTA").Range("N2:N27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("J1").Copy wb1.Sheets("ROTA").Range("P2:P27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("C2:C27").Copy wb1.Sheets("ROTA").Range("C2:C27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("D2:D27").Copy wb1.Sheets("ROTA").Range("E2:E27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("E2:E27").Copy wb1.Sheets("ROTA").Range("G2:G27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("F2:F27").Copy wb1.Sheets("ROTA").Range("I2:I27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("G2:G27").Copy wb1.Sheets("ROTA").Range("K2:K27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("H2:H27").Copy wb1.Sheets("ROTA").Range("M2:M27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("I2:I27").Copy wb1.Sheets("ROTA").Range("O2:O27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
Set wb1 = ThisWorkbook
Set wb2 = Workbooks.Open("G:\TEAM\ES_Mtr_Tech_Ops\Customer Management Centre\Utilisation\Complex\Rota\Rolling Rota 2017.xlsx")
wb2.Sheets("Sheet1").Range("J2:J27").Copy wb1.Sheets("ROTA").Range("Q2:Q27")
wb1.Activate
With wb1.Sheets("ROTA")
End With
End Sub