copy cell content to other sheet if not empty, HOWTO?

Lexje

Active Member
Joined
Jul 6, 2004
Messages
264
Hi Everybody,

I am looking for code to copy the contents of a range of cells to an equal cell range on another sheet, and do this while the original cel is not empty.

Example:

Sheets("Country_1999")
Look through column A:A
While Not IsEmpty(ActiveCell)
Copy contents from Row containing ActiveCell (A:AK) to destination Sheets("DestinationSheet").Same Row
ActiveCell.Offset(1,0).Select
Wend

How can I do this?

Thanks a lot for your help!

Erwin :coffee:
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Andrew, thanks a lot!
That's exactly it, clear and simple!

One more question,
How do I go about to run this code without activating the source sheet?
Can this be done?

If I run this code now, while another sheet is active, I get error 1004 Application-defined or object-defined error.


Next, if we take this one step further, and have the formula iterate through 10 different sheets, how to
1. modify the destination to append the copied cells to the first empty row.
2. add a condition to check wheter contents of the 2nd cell of the destination row contains a value = 1999 (e.g.)

Thank you!

Erwin
(y) (y)
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,730
Members
448,987
Latest member
marion_davis

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