compare two groups of cells and insert if different

dhx10000

Board Regular
Joined
Jul 11, 2005
Messages
144
Hi everyone,

I have an alphabetical list of peoples names in column A, Sheet 1. This list is dynamically generated everyday so sometimes new names appear.

I would like to copy this column into Column A, Sheet 2, but I need it to be smart enough to insert a new row with a new name if it appears in Sheet 1. Its very important that the exact order of the names in Sheet 1 be maintained on Sheet 2.

How can I do something like this?
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
Just change the names of the sheets for your names. Try this:

Code:
Worksheets("Sheet2").Range("A:A").ClearContents 'clear destination
Worksheets("Sheet1").Range("A:A").Copy          'copy sheet 1 Column A
Worksheets("Sheet2").Range("A:A").PasteSpecial  'paste to sheet 2 Column A
Application.CutCopyMode = False                 'clear flashing copy border

Hope that helps! Post back if you have questions.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,999
Members
448,541
Latest member
iparraguirre89

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