Copy and Paste

RockStar75

New Member
Joined
Apr 21, 2011
Messages
11
Hello all,

Not being a total expert with Excel 2010 / VBA I am struggling to create a simple macro that copies an active row from one sheet to the next available row in a different sheet. I keep getting stuck on the active row bit and feel that I have over complicated things.

Would anyone be able to provide me with a simple code that will perform the operation above.

Thank you very much in advance!

Chris
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Try like this

Code:
Sub cpy()
ActiveCell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
 
Upvote 0
Hi Peter!!

Thank you so much...that is so much easier than what I was trying to construct!

Just one additional question...the code you presented copies and pastes the row from in Sheet 1 to the exact same location in Sheet 2. How would the code differ if I wanted to copy the active row from any location in Sheet 1 to the next available row in column A in Sheet 2?

Regards,

Chris
 
Upvote 0
That should paste to a new row each time provided that column A is not blank.
 
Upvote 0
Hmmmm...I thought that would be the case as well; however, it's working in such a way that it's copying to the exact same location in Sheet 2.

I was also wondering, is there a way to copy and paste only the values to the new sheet?

Regards,

Chris
 
Upvote 0
For the values only try

Code:
Sub cpy()
ActiveCell.EntireRow.Copy
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0
Again, thanks!

This time a new issue came up...instead of copying just my selection, it is actually copying and pasting the entire row...all the way from A to ZZ. Very strange!

Regards,

Chris
 
Upvote 0
If you just want the selection try

Code:
Sub cpy()
Selection.Copy
Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End Sub
 
Upvote 0
Yah...I was just about to reply and mention that I had changed the first line to "Selection.Copy"...but you beat me to it! : )

Again, thank you very much...your assistance is much appreciated! : )

Regards,

Chris
 
Upvote 0

Forum statistics

Threads
1,224,597
Messages
6,179,808
Members
452,944
Latest member
2558216095

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