CookieMonster76
Board Regular
- Joined
- Apr 30, 2015
- Messages
- 200
Hi
I have the following which repeats itself over and over, until the point whereby excel cannot run it.
The only difference in each section is the reference to the cells highlighted in red.
Is there a way to consolidate it into a few lines?
Thanks
Paul
With Sheets("Gross Pay")
.Range("A1:B" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("K1")
.Range("E1:E" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("N1")
End With
Range("M4:M" & Range("K" & Rows.Count).End(xlUp).Row).Value2 = Range("N3").Value2
Range("K4:N" & Range("K" & Rows.Count).End(xlUp).Row).Copy Destination:=Range("A1048576").End(xlUp).Offset(1, 0)
Range("K:N").Delete
With Sheets("Gross Pay")
.Range("A1:B" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("K1")
.Range("F1:F" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("N1")
End With
Range("M4:M" & Range("K" & Rows.Count).End(xlUp).Row).Value2 = Range("N3").Value2
Range("K4:N" & Range("K" & Rows.Count).End(xlUp).Row).Copy Destination:=Range("A1048576").End(xlUp).Offset(1, 0)
Range("K:N").Delete
I have the following which repeats itself over and over, until the point whereby excel cannot run it.
The only difference in each section is the reference to the cells highlighted in red.
Is there a way to consolidate it into a few lines?
Thanks
Paul
With Sheets("Gross Pay")
.Range("A1:B" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("K1")
.Range("E1:E" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("N1")
End With
Range("M4:M" & Range("K" & Rows.Count).End(xlUp).Row).Value2 = Range("N3").Value2
Range("K4:N" & Range("K" & Rows.Count).End(xlUp).Row).Copy Destination:=Range("A1048576").End(xlUp).Offset(1, 0)
Range("K:N").Delete
With Sheets("Gross Pay")
.Range("A1:B" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("K1")
.Range("F1:F" & .Range("A" & .Rows.Count).End(xlUp).Row).Copy Destination:=Sheets("Costing Report").Range("N1")
End With
Range("M4:M" & Range("K" & Rows.Count).End(xlUp).Row).Value2 = Range("N3").Value2
Range("K4:N" & Range("K" & Rows.Count).End(xlUp).Row).Copy Destination:=Range("A1048576").End(xlUp).Offset(1, 0)
Range("K:N").Delete
Last edited: