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

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
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,225,606
Messages
6,185,956
Members
453,333
Latest member
BioCoder84

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