How to select all unlocked cells on a sheet?
Try using this function to get there.
Option Explicit
Function GetUnlocked(myWS As Excel.Worksheet) As Excel.Range
Dim r As Excel.Range
Set GetUnlocked = Nothing
For Each r In myWS.UsedRange
If Not r.Locked Then
If GetUnlocked = Nothing Then
Set GetUnlocked = r
Else
Set GetUnlocked = Union(GetUnlocked, r)
End If
End If
Next r
End Function
"Ted M H" wrote:
I need a sub procedure that selects all unlocked cells on a worsheet.
Go to special doesn't offer this as an option. What I want to do is akin to
something like Selection.SpecialCells(xlCellTypeBlanks).Select, but instead
of blanks I want to select cells where Locked = False.
I've tried a few things with Application.FindFormat.Locked = False, but I
can't figure out to select ALL the FindFormat.Locked = False cells.
Any suggestions?
|