Copy range from worksheet to worksheet

Robandemmy

Board Regular
Joined
Jul 16, 2018
Messages
65
Hello,

I am looking for a way to copy a cell range P:T from row 8:200 if populated on one worksheet named “OTV” and paste it in worksheet “Routings” starting in cell A1 while keeping the formatting of the “Routings” worksheet. There are also 6 other tabs that I would like to copy as well and paste sequentially after the “OTV” paste.

Is this possible?

Thanks, I appreciate any help!
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Hi & welcome to MrExcel.
Does this do what you want for the OTV sheet?
Code:
Sub copyData()
   Dim Lr As Long
   With Sheets("OTV")
      Lr = .Range("P" & Rows.Count).End(xlUp).Row
      Sheets("Routings").Range("A1:E" & Lr - 7).Value = .Range("P8:T" & Lr).Value
   End With
End Sub
For the other sheets, do you just have the 8 sheets in your workbook?
If you have more, what are the names of the 6 other sheets?
 
Upvote 0
Thank you for the response!

I have 30 tabs but only need the data from 11 of the tabs. The start of the data string is the same cell (P8) on each worksheet.

Also, I have an edit...I need to paste starting in cell A6 instead of A1.

Thanks
 
Upvote 0
The names of the other sheets being:

269_NK
Extrusion(Profiled)
Extrusion(Profiled)CPX
Calendaring (Flat)
Tringles
Cutter
Complexing
Finishing
Confection
Curing_OGen


<colgroup><col width="61"></colgroup><tbody>
</tbody>
 
Upvote 0
Does the code I supplied do what you want for the 1st sheet?
 
Upvote 0
This may add a lot more work to the code, but row R is useless too me, is copying P:Q and S:T too cumbersome?
 
Upvote 0
Ok, try
Code:
Sub copyData()
   Dim Lr As Long
   Dim i As Long
   Dim Ary As Variant
   
   Ary = Array("OTV", "269_NK", "Extrusion (Profiled)", "Extrusion(Profiled)CPX", "Calendaring (Flat)", "Tringles", "Cutter", "Complexing", "Finishing", "Confection", "Curing_OGen")
   For i = 0 To UBound(Ary)
      With Sheets(Ary(i))
         Lr = .Range("P" & Rows.Count).End(xlUp).Row
         Sheets("Routings").Range("A" & Rows.Count).End(xlUp).Offset(1).Resize(Lr - 7, 5).Value = .Range("P8:T" & Lr).Value
      End With
   Next i
End Sub
This assumes that A5 on Routings has data in before you run the macro
 
Upvote 0

Forum statistics

Threads
1,214,588
Messages
6,120,409
Members
448,959
Latest member
camelliaCase

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top