Quick Excel Question
#1
Scooby Regular
Thread Starter
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes
on
0 Posts
Quick Excel Question
Sure I've done this before, but can't remember how.
Designing a sheet that has numerous cells locked/protected. How do I highlight them all to check I've done all the ones I need to, and not done the others?
Designing a sheet that has numerous cells locked/protected. How do I highlight them all to check I've done all the ones I need to, and not done the others?
#2
Scooby Regular
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes
on
0 Posts
stick this in the module code for the sheet. select the whole sheet and then run either macro.
Sub Select_Locked_Cells()
Dim c As Range
Dim sel As String
On Error GoTo exit_sub
If Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)) Is Nothing Then _
MsgBox "The selected cells are outside the Used Range", _
vbOKOnly + vbInformation, "Error"
Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)).Select
For Each c In Selection.Cells
If c.Locked Then sel = sel & "," & c.Address
Next
If Len(sel) > 1 Then
sel = Mid(sel, 2)
Range(sel).Select
Else
MsgBox "None of the selected cells are Locked", _
vbOKOnly + vbInformation, "Locked"
End If
exit_sub:
End Sub
Sub Select_Unlocked_Cells()
Dim c As Range
Dim sel As String
On Error GoTo exit_sub
If Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)) Is Nothing Then _
MsgBox "The selected cells are outside the Used Range", _
vbOKOnly + vbInformation, "Error"
Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)).Select
For Each c In Selection.Cells
If Not c.Locked Then sel = sel & "," & c.Address
Next
If Len(sel) > 1 Then
sel = Mid(sel, 2)
Range(sel).Select
Else
MsgBox "None of the selected cells are Unlocked", _
vbOKOnly + vbInformation, "Unlocked"
End If
exit_sub:
End Sub
Sub Select_Locked_Cells()
Dim c As Range
Dim sel As String
On Error GoTo exit_sub
If Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)) Is Nothing Then _
MsgBox "The selected cells are outside the Used Range", _
vbOKOnly + vbInformation, "Error"
Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)).Select
For Each c In Selection.Cells
If c.Locked Then sel = sel & "," & c.Address
Next
If Len(sel) > 1 Then
sel = Mid(sel, 2)
Range(sel).Select
Else
MsgBox "None of the selected cells are Locked", _
vbOKOnly + vbInformation, "Locked"
End If
exit_sub:
End Sub
Sub Select_Unlocked_Cells()
Dim c As Range
Dim sel As String
On Error GoTo exit_sub
If Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)) Is Nothing Then _
MsgBox "The selected cells are outside the Used Range", _
vbOKOnly + vbInformation, "Error"
Intersect(Selection, Range("A1", _
Cells.SpecialCells(xlLastCell).Address)).Select
For Each c In Selection.Cells
If Not c.Locked Then sel = sel & "," & c.Address
Next
If Len(sel) > 1 Then
sel = Mid(sel, 2)
Range(sel).Select
Else
MsgBox "None of the selected cells are Unlocked", _
vbOKOnly + vbInformation, "Unlocked"
End If
exit_sub:
End Sub
#3
Scooby Regular
Thread Starter
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes
on
0 Posts
I've done that, but running either macro appears to do nothing (or perhaps its selecting all cells?). Tried with sheet unprotected and protected, same result.
Using Excel XP (2002) if it makes any difference
Cheers
Using Excel XP (2002) if it makes any difference
Cheers
#4
Scooby Regular
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes
on
0 Posts
Thread
Thread Starter
Forum
Replies
Last Post