View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary Brown[_4_] Gary Brown[_4_] is offline
external usenet poster
 
Posts: 209
Default Deleting/Sorting

This will look for bold cells in column A. When it finds them, it will
delete the row that the bold cell is in.
'/=======================================/
' Sub Purpose: Delete all rows where
' the Cell in Column A is BOLD
'/=======================================/
'
Sub DeleteBoldRows()
Dim rng As Range
Dim rCell As Range

On Error GoTo err_Sub

Set rng = Range("A:A")

For Each rCell In rng
If TypeName(Application.Intersect(rCell, _
(ActiveSheet.UsedRange))) = "Nothing" Then
Exit For
End If

If rCell.Font.Bold = True Then
rCell.Rows.Delete Shift:=xlUp
End If

Next rCell

exit_Sub:
On Error Resume Next
Set rng = Nothing
Exit Sub

err_Sub:
Debug.Print "Error: " & Err.Number & " - (" & _
Err.Description
GoTo exit_Sub
End Sub
'/=======================================/


--
Hope this helps.
Thanks in advance for your feedback.
Gary Brown


"Karen" wrote:

Using Excel 2003

I have an Excel report that has over 2,000 rows. I want to delete the rows
where the text/numbers are NOT bold and keep the ones that ARE bold. Im not
sure if this is possible. If this cannot be done based on that criterion, the
rows I want to keep all have a number value in column E. Maybe it's possible
to isolate only the rows that have a value in column E. Im not sure how to
do this.

I would sort the records, but some of the cells I dont want are merged. At
least all of the rows I want to keep do not have any merged cells. Is this
possible? The range of data is A2:E2169.

Any help would be greatly appreciated €“ Thanks, Karen