Copy the ActiveCell row into another worksheet

danjames11

New Member
Joined
Apr 22, 2009
Messages
14
I need the VBA code to copy the ActiveCell Row into the Worksheet called Cancellations. I need to copy the row onto a new line everytime in Cancellations.


I tried ActiveCell.copy (Cancellations!), but this would not work, and it would only copy the ActiveCell, but I want the whole row that the active cell is on to be copied. It also has to copy onto a new row in the other worksheet every time.

Thanks, Dan
 

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.
Try

Code:
Sub CpyAct()
ActiveCell.EntireRow.Copy Destination:=Sheets("Cancellations").Range("A" & Rows.Count).End(xlUp).Offset(1)
End Sub
 
Upvote 0
Great, that worked fine. It takes the row into the sheet cancelled and works well. The other thing I would like is that, when it takes the data into the sheet cancelled, for it to add todays date to column P to whatever row was just added. So then It would basically say the people that have cancelled and the date they canceled at the end.

This might be abit of extra work but you seem like you can do it. So ive got it to add the active row data into the other sheet, all i'd like now is for it to also add todays date onto that row at the end aswell.

Thanks, Dan.
 
Upvote 0
Try

Code:
Sub CpyAct()
ActiveCell.EntireRow.Copy Destination:=Sheets("Cancellations").Range("A" & Rows.Count).End(xlUp).Offset(1)
Sheets("Cancellations").Range("P" & Rows.Count).End(xlUp).Value = Date
End Sub
 
Upvote 0
It added the date to the sheet cancelled, and also added it to column P, but didn't add it to the correct Row Number. The date went to P1, wheras the Row of data went to Row 3. Any Ideas?

Thanks, Dan
 
Upvote 0
Oh, Good News, I figured out why it wasn't working and now it works fine, I added the offset to the date aswell so that it would work. EG:


Sheets("Cancellations").Range("P" & Rows.Count).End(xlUp).Offset(1).Value = Date
</pre>
So thanks alot for helping me with this. If I need anything else (which I probably will soon), I'll ask you.

Thanks Alot, Dan
 
Upvote 0
Sorry about the (lack of) Offset - I was posting in a hurry as about to go out.

Thinking about this more, it would be possible for this to be done automatically if you double-clicked a cell (for example). Post back if you're interested in that.
 
Upvote 0
The way I've done it now is you click a button saying "client cancelled" and then it adds a "(Cancelled)" onto the end of there name, and then with the help of you, adds them into the cancelled clients sheet. So no, I won't need that but I wouldn't be as far as this if it wasn't for you so, thanks. I'll get in touch if I need anything else.

Dan
 
Upvote 0

Forum statistics

Threads
1,214,629
Messages
6,120,630
Members
448,973
Latest member
ChristineC

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