vba/macro to copy data from one sheet to another sheet

Magwa

New Member
Joined
Apr 13, 2014
Messages
1
HI There

I am new vba/macros and would like to see if anyone can help me the code below.

When the code is run - it clears the contents of the sheet previous cellsA13:bo3150 which works
Then it copies all rows from CFH sheet starting from row A13 which I want. But I then need to paste it back into the Previous Sheet starting at row A13 - but when it runs it pastes them at the end of the current table rather than starting the paste at row/cell A13.



Sub cpynpst()
Dim PreCFH As Worksheet, CFHAss As Worksheet, lr As Long, rng1 As Range,
'Cleardown Range
Sheets("Previous").Select
Range("A13:BO50006").Select
Selection.ClearContents
Set PreCFH = Sheets("CFH")
Set CFHAss = Sheets("Previous")
lr = PreCFH.Cells(Rows.Count, 1).End(xlUp).Row
Set rng1 = PreCFH.Range("A13:A" & lr)
rng1.EntireRow.Copy CFHAss.Cells(Rows.Count, 1).End(xlUp)(2)
End Sub

Thanks

Magwa
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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