Extracting unwanted rows from a excel workbook

thales

New Member
Joined
Apr 28, 2012
Messages
3
Hello,

I have the following problem in the examle below which start on cell a1 to the end (last row will be blank):
It's a list imported from a pdf file in which I just want to keep the rows maked in yellow( originaly they are not in yellow.I marked just to highlight the rows that I want to keep).
I can see that it starts in A1 (the info that I want to keep) and has 13 rows that I want to delete under until the next row that I want to keep.
At the end I just want to have the raws in yellow and it would be like this:
<TABLE style="WIDTH: 281pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=374 x:str><COLGROUP><COL style="WIDTH: 281pt; mso-width-source: userset; mso-width-alt: 15957" width=374><TBODY><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; WIDTH: 281pt; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl65 height=16 width=374>1031 GEWURZTRAMINER</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl65 height=16>1035 POULLY FUME LES</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl65 height=16>1040 QUINTA DA BACALHOA
.... and so on
The code has to be flexible to choose the number of rows to be deleted. In this case 13( number of rows between the two yellow rows that I want to keep)
Also, after having removed all the unwanted rows I will have to break the information on each cell into two columns the first with the numeric code and the second with the name( ex: a1=1031 and b1= GEWURZTRAMINER)

Thanks for the help


</TD></TR></TBODY></TABLE>
example of the rows that I want to work on.

<TABLE style="WIDTH: 281pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=374 x:str><COLGROUP><COL style="WIDTH: 281pt; mso-width-source: userset; mso-width-alt: 15957" width=374><TBODY><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: yellow; WIDTH: 281pt; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl63 height=16 width=374>1031 GEWURZTRAMINER</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid estq: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Grupo:FRANÇA</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço custo: 68,88</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Vendável</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Estocável</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid compra: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Tipo:</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>um para um</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço lista: 0,00</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>DInativo</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Serviço</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid venda: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Pnl. contas: saidas operacionais » compra de produtos diretos » bebidas » vinhos</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: yellow; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl63 height=16>1035 POULLY FUME LES</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid estq: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Grupo:FRANÇA</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço custo: 0,00</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Vendável</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Estocável</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid compra: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Tipo:</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>um para um</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço lista: 0,00</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>DInativo</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Serviço</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid venda: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Pnl. contas: saidas operacionais » compra de produtos diretos » bebidas » vinhos</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: yellow; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" class=xl63 height=16>1040 QUINTA DA BACALHOA</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid estq: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Grupo:PORTUGAL</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço custo: 87,33</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Vendável</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Estocável</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid compra: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Tipo:</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>um para um</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Preço lista: 0,00</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>DInativo</TD></TR><TR style="HEIGHT: 12pt; mso-height-source: userset" height=16><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 12pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=16>0Serviço</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Unid venda: GF</TD></TR><TR style="HEIGHT: 9.95pt; mso-height-source: userset" height=13><TD style="BORDER-BOTTOM: #d4d0c8; BORDER-LEFT: #d4d0c8; BACKGROUND-COLOR: white; HEIGHT: 9.95pt; BORDER-TOP: #d4d0c8; BORDER-RIGHT: #d4d0c8" height=13>Pnl. contas: saidas operacionais » compra de produtos diretos » bebidas » vinhos</TD></TR></TBODY></TABLE>
 
Thanks Rick, so simple that i'm feeling like a fool rsrsrs....
I'll will run the code and see if it works.
Thanks to all others that contribute to this post
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,221,444
Messages
6,159,912
Members
451,601
Latest member
terrynelson55

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