Hi, I am using the following code (I found here), to test for unlocked cells when I am creating a sheet. (I'm really new at this) I have 2 issues. First this (below) doesn't end itself, I have to escape or pick another cell.
Second, I would like another button to return cells to the previous color after I have corrected any locked/unlocked cell errors.
Thanks,
Rick
Private Sub CommandButton2_Click()
Sheets("bf calcs").Select
Sheets("bf calcs").Unprotect ""
For Each rCell In Sheets("bf calcs").Range("A11:d41").Cells
If rCell.Locked = False Then rCell.Interior.ColorIndex = 5
Next rCell
Sheets("bf calcs").Protect ""
End Sub
Second, I would like another button to return cells to the previous color after I have corrected any locked/unlocked cell errors.
Thanks,
Rick
Private Sub CommandButton2_Click()
Sheets("bf calcs").Select
Sheets("bf calcs").Unprotect ""
For Each rCell In Sheets("bf calcs").Range("A11:d41").Cells
If rCell.Locked = False Then rCell.Interior.ColorIndex = 5
Next rCell
Sheets("bf calcs").Protect ""
End Sub