Excel

Hightlight all protected cells

Ease of Use

Easy

Version tested with

97 

Submitted by:

Steiner

Description:

A simple macro to highlight all protected cells on a worksheet. 

Discussion:

Sometimes you get a new workbook from a colleague where it's not obvious which cells are locked and you don't like to find that out by trial and error. WARNING! As this macro uses the interior color to highlight the cells, I'd advise you to use it on a copy of the worksheet in question because all other colorings will be lost. 

Code:

instructions for use

			

Sub HightlightProtected() Dim rCell As Range For Each rCell In ActiveSheet.UsedRange If rCell.Locked = True Then rCell.Interior.ColorIndex = 36 Else rCell.Interior.ColorIndex = xlNone End If Next rCell End Sub

How to use:

  1. create a copy of the worksheet you want to check (see discussion above)
  2. open the VBA-Editor (Alt + F11)
  3. insert a new module and copy & paste the code there
  4. go back to Excel and select the worksheet you want to process
  5. run the code
 

Test the code:

  1. download the sample and run it
 

Sample File:

Highlight.zip 9.06KB 

Approved by mdmackillop


This entry has been viewed 204 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express