Remove a row if data is bold

J

JR

I have a report that comes from another source. It repeats the header
every so many lines and that can vary. The header is the only bold
thing in the spreadsheet. Is there a way to parse thru the
spreadsheet and any row that it finds something in the A column is
bold, delete the whole row? Also there are funny characters in the
spreadsheet at the end and I have the below macro running to strip it
all out. Not sure if a macro could be integrated into this so there
is only one?

Sub fixme()
Selection.Replace What:=Chr(160), Replacement:="", LookAt:=xlPart,
_
SearchOrder:=xlByRows, MatchCase:=False
End Sub

Any ideas would be appreciated.

Thanks.

JR
 
D

Don Guillett

Try

Sub deleteboldrows()
mc="a"
For i = 2 To cells(rows.count,mc).end(xlup).row
If Cells(i, mc).Font.Bold Then Rows(i).Delete 'MsgBox i
Next i
other code here
End Sub
 
M

Mike H

Hi,

If there's a possibility that 2 adjacent rows could be bold you may want to
run the code backwards by changing this line

For I = Cells(Rows.Count, mc).End(xlUp).Row To 2 Step -1

Mike
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top