Peter, im going to mess around with your code a little and see if it does what i want.
The actual problem i am having is with the code below. It is supposed to:
1 - unprotect the sheet (if it was protected to begin with)
2- clear the contents of the cells in the col defined by sheet points.
3- select the upper most unlocked cell in the scroll area
4- protect the sheet if it was protected to begin with.
The problem occurs when i try to run the code on a protected sheet. Everything works fine, except that the upper most unlocked cell in the scroll area gets selected but is not framed (you cant tell that it is selected).
I can click on different unlocked cells on the sheet & they do not become framed either (i know they are selected because when i type characters appear in the cells)
This problem is driving me crazy and taking up alot of time. Seems like it should be an easy thing to fix, but im having trouble getting a response on this question. The current thread is an effort to fix this problem (think maybe the problem is in the CELL CURSOR SELECT part of the code.
Do you have any idea what the problem could be or how i could go about resolving it? thanks
Code:
Sub CLEAR11111()
'
' CLEAR TOPOUT
'
'UNPROTECT
Dim IsProtected As Boolean
IsProtected = ActiveSheet.ProtectContents
If IsProtected Then
ActiveSheet.Unprotect
End If
'CLEAR
Dim StartRow&, EndRow&
With Range(ActiveSheet.ScrollArea)
StartRow = .Row: EndRow = .Rows.Count + .Row - 1
End With
Range(Cells(StartRow, (Sheets("POINTS").Range("EI108").Value)), Cells(EndRow, (Sheets("POINTS").Range("EI109").Value))).ClearContents
'CELL CURSOR SELECT
Dim CRng As Object, Cell As Object
Set CRng = Application.Intersect(Range(ActiveSheet.ScrollArea), Columns([POINTs!ei108]))
CRng.Select
For Each Cell In CRng
If Cell.Locked = False Then
Cell.Select
Exit Sub
End If
'PROTECT
If IsProtected Then
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
ActiveSheet.EnableSelection = xlUnlockedCells
End If
Next Cell
End Sub