ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Non-bolded lines only (https://www.excelbanter.com/excel-programming/333785-delete-non-bolded-lines-only.html)

Annette

Delete Non-bolded lines only
 
How would I write to delete any lines that in column A which are not bolded
and not include blank cells?

Thanks!

Annette



Tom Ogilvy

Delete Non-bolded lines only
 
Dim lastrow as Long
Dim i as Long
Dim cell as Range
lastrow = cells(rows.count,1).End(xlup).row
for i = lastrow to 1 step -1
set cell = cells(i,1)
if cell.Font.Bold then
if not isempty(cell) then
cell.EntireRow.Delete
end if
end if
Next

--
Regards,
Tom Ogilvy

"Annette" wrote in message
...
How would I write to delete any lines that in column A which are not

bolded
and not include blank cells?

Thanks!

Annette





Bob Phillips[_7_]

Delete Non-bolded lines only
 

iLastRow = Cells(Rows.Count,"A").End(xlUp).Row
For i = iLastRow to 1 step -1
If Cells(i,"A").Value = "" Or _
Cells(i,"A").Font.Bold = False Then
Rows(i).Delete
End If
Next i

--
HTH

Bob Phillips

"Annette" wrote in message
...
How would I write to delete any lines that in column A which are not

bolded
and not include blank cells?

Thanks!

Annette






All times are GMT +1. The time now is 09:08 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com