|
-
Jan 22nd, 2004, 03:54 PM
#2
Junior Member
Hey there,
OK, this should get you started.
Sub DeleteLinesWacky()
'
Dim blnFound As Boolean
Dim strText As String 'This is the text you are looking for
Dim intLastRow As Integer 'This keeps a record of the last row you found your bold text in
Dim intFoundRow As Integer 'This is the row under the row you find your string
'
strText = "Josh"
'
intLastRow = 1
blnFound = True
Do Until blnFound = False
On Error Resume Next
Range(intLastRow & ":65536").Find(What:=strText).Activate
If blnFound = True Then
ActiveCell.Offset(1, 0).Select
intFoundRow = ActiveCell.Row
Do Until ActiveCell.Font.Bold = True Or ActiveCell.Row = 65536
ActiveCell.Offset(1, 0).Select
Loop
If ActiveCell.Row = 65536 Then Exit Sub
intLastRow = ActiveCell.Row - 1
If intFoundRow < intLastRow Then
Range(intFoundRow & ":" & intLastRow).Select
Selection.Delete
End If
Range("A" & intFoundRow).Select
intLastRow = ActiveCell.Row
End If
Loop
End Sub
Last edited by Yesuslave; Jan 22nd, 2004 at 04:44 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|