View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Ideal Code deleting rows/based on bold text

Sub test()
Dim i As Long

With ActiveSheet
i = .Cells(Rows.Count, 1).End(xlUp).Row

Do Until i < 1
If .Cells(i, 1).Font.Bold = True Then
i = i - 2
Else
.Rows(i).Delete xlShiftUp
i = i - 1
End If
Loop
End With
End Sub


--
Rob van Gelder - http://www.vangelder.co.nz/excel


"Samm" wrote in message
...
Is a code run where it selects only the lines that have bolded text plus

one
(above) and delete all others lines that are not qualified. Is this
possible?

Say, there are bold number or text found on rows 5, 8, 12, 22. When the
code runs, it would delete rows

1, 2, 3, 6, 9, 10, 13, 14, 15, 16, 17, 18, 19, and 20.

Can this be done?