ultracyclist
Active Member
- Joined
- Oct 6, 2010
- Messages
- 274
- Office Version
- 365
- Platform
- Windows
I created the following macro to delete all rows that have a cell background color of Yellow in Column D
</SPAN>
When I run the code some rows that are in Yellow do not get deleted.
Any thoughts?
Thanks,
Allen</SPAN>
Code:
Sub deleterow()
Dim myRange as Range
Dim cell As Range
Application.Calculation = xlCalculationManual
Set myRange = Worksheets(1).Range("D2:D1200")
For Each cell In myRange
If cell.Interior.ColorIndex = 6 Then
cell.EntireRow.Delete
End If
Next cell
Application.Calculation = xlCalculationAutomatic
End Sub
When I run the code some rows that are in Yellow do not get deleted.
Any thoughts?
Thanks,
Allen</SPAN>