View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KM[_2_] KM[_2_] is offline
external usenet poster
 
Posts: 24
Default Select all the unlocked cells on a worksheet

You can use the following code

Dim rgeStart As Range
Dim rgeEnd As Range
Dim Z As Integer, Y As Integer
Dim str1 As String, str2 As String

Set rgeStart = Application.Range("A1")
Set rgeEnd = Application.Cells.SpecialCells
(xlCellTypeLastCell)

For Z = 1 To rgeEnd.Row
For Y = 1 To rgeEnd.Column
If Not Application.Cells(Z, Y).Locked Then
str1 = Mid(Application.Cells(Z, Y).Address, 2, 1)
& Mid(Application.Cells(Z, Y).Address, 4, 1) & ","
str2 = str2 & str1
End If
Next Y
Next Z
str2 = Left$(str2, Len(str2) - 1)
Application.Range(str2).Select


-----Original Message-----
Hi,

does anyone know how to select all the unlocked cells on

a
worksheet.

All i need to do is show which cells are unlocked without
changing the formatting of the cells.

Thanks for any help,

Steven
.