View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
StargateFan StargateFan is offline
external usenet poster
 
Posts: 61
Default Filterable alternating row colour formula skewed when rows deleted.

I haven't tested this manually, actually, but the situation I have now
is this:

1. A3 has this formula so that the rows have alternating colour that
hold the alternating pattern even when filtered:

=AND(MOD(SUBTOTAL(3,$B3:$B$3),2)=0,$B3<"")

2. The problem lies in that the sheet is protected and because of
this, I delete cells via a delete rows macro, which is this:

Sub DeleteRow()
Dim MyMsgBox As Long
MyMsgBox = MsgBox("Are you sure you really want to delete
this/these row(s)?? :oD", vbOKCancel + vbExclamation, "Delete ... ?")

If MyMsgBox = vbOK Then

Selection.EntireRow.Delete
ActiveCell.Select
ActiveCell.Offset(-1, 0).Select

End If
' Re-protects sheet in case anything unprotects it, yet allows vb
functioning to remain.
With ActiveSheet
.EnableAutoFilter = True
.Protect UserInterfaceOnly:=True
End With
End Sub

[** Re the above codes, none of them are mine. They were kind gifts
from people in this ng.]

3. The challenge is that today I ran into a "glitch" in that rows
deleted with the above delete row macro make the alternate colouring
not work properly anymore. I'm guessing that this may happen since
rows have specific cell references and that when they're deleted, it
throws sequencing off somehow (?).

Is there another way to delete rows without knocking out the
filter-proof alternating row colouring? Seems like a tall order but
hopefully there is something that can be done.

Thanks! :oD