Macro To Copy Unique Data

Dazzawm

Well-known Member
Joined
Jan 24, 2011
Messages
3,786
Office Version
  1. 365
Platform
  1. Windows
I have a lot of rows and columns on sheet1 with various data. What I need the macro to do is look at column 'H' then column 'G'. As you can see rows 1-4 and 6-7 have the same data in column 'H' but a choice of Manual or Automatic in column 'G'. I want just the ones with Automatic only (not all rows with automatic in) copied onto sheet 2, like rows 5 and 8. Thanks.


Sheet1

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Arial,Arial; FONT-SIZE: 10pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 67px"><COL style="WIDTH: 67px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt"><TD> </TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD><TD>I</TD><TD>J</TD><TD>K</TD><TD>L</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">1</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">MANUAL</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS4_43A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">2</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">MANUAL</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS4_43A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">3</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS4_43A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">4</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS4_43A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">5</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">LSGS4_35A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">6</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS5_35A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">7</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">MANUAL</TD><TD style="BACKGROUND-COLOR: #ffff00; FONT-SIZE: 8pt">LSGS5_35A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">8</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">LSGS5_35D</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR></TBODY></TABLE>

Sheet2

<TABLE style="BACKGROUND-COLOR: #ffffff; PADDING-LEFT: 2pt; PADDING-RIGHT: 2pt; FONT-FAMILY: Arial,Arial; FONT-SIZE: 10pt" border=1 cellSpacing=0 cellPadding=0><COLGROUP><COL style="WIDTH: 30px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 67px"><COL style="WIDTH: 67px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"><COL style="WIDTH: 86px"></COLGROUP><TBODY><TR style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD><TD>I</TD><TD>J</TD><TD>K</TD><TD>L</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">1</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">LSGS4_35A</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR><TR style="HEIGHT: 17px"><TD style="TEXT-ALIGN: center; BACKGROUND-COLOR: #cacaca; FONT-SIZE: 8pt">2</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">AUTOMATIC</TD><TD style="BACKGROUND-COLOR: #99cc00; FONT-SIZE: 8pt">LSGS5_35D</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD><TD style="FONT-SIZE: 8pt">VARIOUS DATA</TD></TR></TBODY></TABLE>
 
Thanks Colin, exactly what I was after. And thanks to everyone else for all your help too, much appreciated.
 
Upvote 0

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,551
Messages
6,179,476
Members
452,915
Latest member
hannnahheileen

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