vba code copy range to last row and paste into another sheet

DanielFran

New Member
Joined
Apr 19, 2018
Messages
35
Hi,

I need to write a vba code that copies a range in sheet 1 from A7:J7 until the last row with data, than paste into sheet 2 in cell A5.


Many thanks,
Daniel
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Try:
Code:
Sub Macro1

Dim x as Long

x = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row - 6
Sheets("Sheet2").Cells(5, 1).Resize(x, 10).Value = Sheets("Sheet1").Cells(7,1).Resize(x, 10).Value

End Sub
 
Last edited:
Upvote 0
You're welcome Daniel, thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,443
Messages
6,124,890
Members
449,194
Latest member
JayEggleton

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