View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default To delete specific color index row

Hi Junior,

You should try to avoid selections as these are usually
unnecessary and inefficient.Additionally, it is advisable
always to declare all variables explicitly.

Perhaps, however, you could explain what the variable
LastRow is intended to refer to and exactlty what the
procedure is intended to do


---
Regards,
Norman


"Junior728" wrote in message
...
Hi,

I tried to run the macro code below, but it does not even run when i
execute. Not sure if i have typed the code correctly??? Can someone
advise?

Sub Testing()

ActiveSheet.Activate
Range("A1").Select


For i = 1 To Cells(Rows.Count, "A").End(xlUp).Row

If Rows(i).Interior.ColorIndex = 6 Then
Rows(LastRow).Select
Selection.Delete

i = i + 1
End If

Next i

End Sub