Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How do U Color shade Locked and FormulaHidden Cells

Hi all,
How do i color shade cells say yellow in a sheet that does not have
locked and FormulaHidden. The idea is to see at a glance which cells
are editable. Many thks KZ

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default How do U Color shade Locked and FormulaHidden Cells

Hi Kieranz,

you can use this:

Function IsHiddenOrLocked(Target As Range) As Boolean
Dim varPom As Variant
Set Target = Target.Cells(1, 1)
varPom = (Target.Locked = True) Or (Target.FormulaHidden = True)
If IsNull(varPom) Then
IsHiddenOrLocked = False
Else
IsHiddenOrLocked = varPom
End If
End Function

Sub FormatHiddenOrLocked()
Dim Target As Range
Dim Cel As Range

Set Target = Intersect(Selection, Selection.Parent.UsedRange)
For Each Cel In Target
If IsHiddenOrLocked(Cel) Then Cel.Interior.ColorIndex = 6
Next Cel
End Sub

Regards,
Ivan

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default How do U Color shade Locked and FormulaHidden Cells

Hi Kieranz,

Try something like:

'=============
Public Sub ToggleLockedCellsColor()
Dim rCell As Range
Dim iColor As Long
Dim bNoColor As Boolean
Dim bLocked As Boolean
Dim res As String

res = InputBox("Enter the sheet protection password")

iColor = 6 '<<==== Yellow - Change to taste
bLocked = False

On Error Resume Next
ActiveSheet.Unprotect res
If Err.Number < 0 Then
MsgBox "Password not recognised"
Exit Sub
End If

For Each rCell In ActiveSheet.UsedRange.Cells
With rCell
If .Locked Then
bNoColor = rCell.Interior.ColorIndex = xlNone
bLocked = True
Exit For
End If
End With
Next rCell

If Not bLocked Then
MsgBox Prompt:="No locked cells found!", _
Buttons:=vbInformation, _
Title:="Locked Cells"
End If

For Each rCell In ActiveSheet.UsedRange.Cells
With rCell
If .Locked Then
.Interior.ColorIndex = IIf(bNoColor, iColor, xlNone)
End If
End With
Next

ActiveSheet.Protect res

End Sub
'<<=============

See also:

http://tinyurl.com/syl22


---
Regards,
Norman


"Kieranz" wrote in message
oups.com...
Hi all,
How do i color shade cells say yellow in a sheet that does not have
locked and FormulaHidden. The idea is to see at a glance which cells
are editable. Many thks KZ



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How do U Color shade Locked and FormulaHidden Cells

Many thks Ivan and Norman
Just great
Rgds
KZ

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a formlula to replace cell shade color with another color Newsgal Excel Worksheet Functions 4 February 9th 10 09:21 AM
shade one cell that will shade multiple cells Walt Excel Discussion (Misc queries) 1 November 17th 09 03:46 PM
Shading cells - how to pick a slight/different shade of a color Mark New Users to Excel 4 January 1st 09 09:53 PM
How can I count the number of cells with a particular color/shade Lynn Excel Worksheet Functions 3 June 5th 08 08:51 AM
color/shade cell upon input MarkT Excel Discussion (Misc queries) 5 November 5th 05 02:22 PM


All times are GMT +1. The time now is 04:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"