Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

Quick Excel Question

Thread Tools
 
Search this Thread
 
Old 04 March 2004, 04:48 PM
  #1  
Fig
Scooby Regular
Thread Starter
 
Fig's Avatar
 
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes on 0 Posts
Default 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?
Old 05 March 2004, 08:49 AM
  #2  
Fosters
Scooby Regular
 
Fosters's Avatar
 
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes on 0 Posts
Default

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
Old 05 March 2004, 09:35 AM
  #3  
Fig
Scooby Regular
Thread Starter
 
Fig's Avatar
 
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes on 0 Posts
Default

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
Old 05 March 2004, 09:45 AM
  #4  
Fosters
Scooby Regular
 
Fosters's Avatar
 
Join Date: Jul 2000
Location: Islington
Posts: 2,145
Likes: 0
Received 0 Likes on 0 Posts
Default

I've just tried this and it works.

email me on toye.m@mellon.com
Old 05 March 2004, 12:11 PM
  #5  
Fig
Scooby Regular
Thread Starter
 
Fig's Avatar
 
Join Date: Aug 2002
Location: not forgetting 20,000 posts from last time ;)
Posts: 5,806
Likes: 0
Received 0 Likes on 0 Posts
Default

YHM
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
JimBowen
ICE
5
02 July 2023 01:54 PM
Shaun
Other Marques
33
26 October 2015 10:57 AM
ALEXSTI
General Technical
5
28 September 2015 09:29 PM
Ozne
General Technical
2
27 September 2015 03:06 PM
M4RKG
Wanted
4
25 September 2015 09:54 PM



Quick Reply: Quick Excel Question



All times are GMT +1. The time now is 07:36 PM.