Michael151
Board Regular
- Joined
- Sep 20, 2010
- Messages
- 247
Hello all,
Trying to write a macro that will compare two lists, then delete rows based on matching and non-matching results.
I have two sheets: sheet A and sheet B. If a title on sheet A is not found on sheet B, then delete that title on sheet A.
On sheet A, the list is in column 1. However, in sheet B, the titles are under the column labeled “Title” which can be in any column. This is why I’d like to use the header in row 1 to identify this column.
For example:
Sheet A:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title5
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title9
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title10
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title12
</td> </tr> </tbody></table>
Sheet B:
<table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"><tbody><tr style="height: 12.75pt;"><td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">Title
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> </tbody></table>
Sheet A after macro:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"><tbody><tr style="height: 12.75pt;"><td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">Title
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> </tbody></table>
The row containing the extra Titles on sheet A are deleted because these titles are not found on sheet B. Any help is most appreciated! Thank you.
Trying to write a macro that will compare two lists, then delete rows based on matching and non-matching results.
I have two sheets: sheet A and sheet B. If a title on sheet A is not found on sheet B, then delete that title on sheet A.
On sheet A, the list is in column 1. However, in sheet B, the titles are under the column labeled “Title” which can be in any column. This is why I’d like to use the header in row 1 to identify this column.
For example:
Sheet A:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman";} </style> <![endif]--> <table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"> <tbody><tr style="height: 12.75pt;"> <td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title3
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title5
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title9
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title10
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title12
</td> </tr> </tbody></table>
Sheet B:
<table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"><tbody><tr style="height: 12.75pt;"><td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">Title
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> </tbody></table>
Sheet A after macro:
<!--[if gte mso 9]><xml> <w:WordDocument> <w:View>Normal</w:View> <w:Zoom>0</w:Zoom> <w:Compatibility> <w:BreakWrappedTables/> <w:SnapToGridInCell/> <w:WrapTextWithPunct/> <w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--><table class="MsoNormalTable" style="width: 48pt; margin-left: 4.65pt; border-collapse: collapse;" border="0" cellpadding="0" cellspacing="0" width="64"><tbody><tr style="height: 12.75pt;"><td style="width: 48pt; border: 1pt solid windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap">Title
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title1
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title2
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title4
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title6
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title7
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title8
</td> </tr> <tr style="height: 12.75pt;"> <td style="width: 48pt; border-width: medium 1pt 1pt; border-style: none solid solid; border-color: -moz-use-text-color windowtext windowtext; padding: 0in 5.4pt; height: 12.75pt;" valign="bottom" width="64" nowrap="nowrap"> Title11
</td> </tr> </tbody></table>
The row containing the extra Titles on sheet A are deleted because these titles are not found on sheet B. Any help is most appreciated! Thank you.