Finding out whats Protected...

D

Darin Kramer

Hi guys,

I got a sheet with some cells protected, and others not, how can I see
which are the cells that are protected..? (on screen..)

Also is it possible to write some VB, that will give me a list of all
protect cells for a given sheet...?

Thanks!!

Regards

D

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
P

papou

Hello Darin
In your worksheets, by design, all cells are locked so may be it would be
wiser to look for those which are NOT locked?
In which case may be something like this should help:
(amend sheet name accordingly and you will also need an additional worksheet
named "Analysis")
Sub TestIt()
Dim NbUnLckd As Long
NbUnLckd = 0
For Each c In Worksheets("Sheet1").Range("A1").CurrentRegion
If c.Locked = False Then
NbUnLckd = NbUnLckd + 1
Worksheets("analysis").Cells(NbUnLckd, 1).Value = c.Address
End If
Next c
End Sub

HTH
Cordially
Pascal
 
D

Darin Kramer

Thanks Pascal

Unfortunately, nothing happens when I run the macro :)
No error message even, and nothing on sheet Analysis


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
B

Bob Phillips

This will highlight locked cells

Sub LockedCells()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.Locked Then
With cell
With .Interior
.ColorIndex = 35
.Pattern = xlSolid
End With
.BorderAround LineStyle:=xlDashDotDot, Weight:=xlThick,
ColorIndex:=5
End With
End If
Next cell
End Sub

Change
If cell.Locked Then
to
If Not cell.Locked Then
if you want to highlight non-locked cells.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top