Archive of Mr Excel Message Board
Using this VB script:
Sub Change()
Dim Cnt As Integer
For Cnt = 1 To 500
If UCase(Range("B" & Cnt)) = "*TOTAL*" Then
Range("A" & Cnt, "N" & Cnt).Interior.ColorIndex = 4
End If
Next
End Sub
Now, Is there a way to delete rows that contain the word *Total* in column A, but not column b? I am trying to automate some reports that require a ton of formatting each day.
If you would like me to email you a copy of the report to see what I am talking about - please email me.
Thanks,
David

| Check out our Excel VBA Resources | ||||
![]() |
![]() |
![]() |
![]() |
![]() |

Its me again.

sub delete1()
Range("a1:a500").Select
For Each cell In Selection
If cell.Value = "*TOTAL*" Then
Selection.EntireRow.Delete
End If
Next cell
Range("a1").Select
end sub
sub delete2()
Range("a1:a20000").Select
For Each cell In Selection
If cell.Value = "*TOTAL*" Then
cell.ClearContents
End If
Next cell
Range("a1:a20000").Select
Selection.SpecialCellsxlCellTypeBlanks).EntireRow.Delete
end sub
Cheers!

sub delete2()
Range("a1:a20000").Select
For Each cell In Selection
If cell.Value = "*TOTAL*" Then
cell.ClearContents
End If
Next cell
Range("a1:a20000").Select
Selection.SpecialCells(xlCellTypeBlanks).EntireRow.Delete
end sub
Cheers!

Sub delete1()
Range("a1:a500").Select
For Each cell In Selection
If cell.Value = "*TOTAL*" Then
cell.EntireRow.delete
End If
Next cell
Range("a1").Select
End Sub

Thanks agin for all your help. Feel free to email me directly if you would like a copy of one of these reports to see what I am talking about.
David
david.morris@target.com
