Raj
Until the Excel developers get around to your request, use this code from Bob
Flanagan.
Sub Locked_Cells()
Dim Cell As Range, tempR As Range, rangeToCheck As Range
'check each cell in the selection
For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
If Cell.Locked Then
If tempR Is Nothing Then
'initialize tempR with the first qualifying cell
Set tempR = Cell
Else
'add additional cells to tempR
Set tempR = Union(tempR, Cell)
End If
End If
Next Cell
'display message and stop if no cells found
If tempR Is Nothing Then
MsgBox "There are no Locked cells " & _
"in the selected range."
End
End If
'select qualifying cells
tempR.Select
' tempR.Interior.ColorIndex = 3
End Sub
Sub UnLocked_Cells()
Dim Cell As Range, tempR As Range, rangeToCheck As Range
'rotate through all cells in the selection
Cells.Select
For Each Cell In Intersect(Selection, ActiveSheet.UsedRange)
If Not Cell.Locked Then
'add to tempR if unprotected
If tempR Is Nothing Then
'do it this way for the first unprotected cell
Set tempR = Cell
Else
'add subsequent cells this way.
Set tempR = Union(tempR, Cell)
End If
End If
Next Cell
'do this upon completion of the For..Next checking
If tempR Is Nothing Then
MsgBox "There are no UnLocked cells in " & _
"the selected range."
End
End If
'select qualifying cells
tempR.Select
'tempR..Interior.ColorIndex = 3
'tempR.ClearContents
End Sub
Gord Dibben Excel MVP
On Wed, 15 Sep 2004 03:23:01 -0700, "Rajanikanth Naik" <Rajanikanth