ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Protecting Cell loses formatting (https://www.excelbanter.com/excel-discussion-misc-queries/221591-protecting-cell-loses-formatting.html)

FP Novice

Protecting Cell loses formatting
 
In a lookup sheet I have made I set the cells that hold my formulas to be
locked on protection. These cells that I speak of change text color based on
the returned results from the lookup. My trouble shows up after I protect the
worksheet, once protected the cells no longer change text color based on the
returned results.

File can be provided for review.

FP Novice

Protecting Cell loses formatting
 
Also, I am not using conditional formatting since the field can return any
one of twelve different text colors., I was thinking about defining the text
to color in VB but am not certain where to start.

"FP Novice" wrote:

In a lookup sheet I have made I set the cells that hold my formulas to be
locked on protection. These cells that I speak of change text color based on
the returned results from the lookup. My trouble shows up after I protect the
worksheet, once protected the cells no longer change text color based on the
returned results.

File can be provided for review.


FP Novice

Protecting Cell loses formatting
 
This is what I have so far, the macro does not like the Me.Range. What should
I be using?

Private Sub Color_G6()
Dim Num As Long
Dim rng As Range
Set rng = Me.Range("G6")
On Error GoTo endit
Application.EnableEvents = False
'Determine the color
Select Case UCase(rng.Value)
Case Is = "BLUE": Num = 5 'blue
Case Is = "ORANGE": Num = 45 'orange
Case Is = "GREEN": Num = 10 'green
Case Is = "BROWN": Num = 53 'brown
Case Is = "SLATE": Num = 15 'slate
Case Is = "WHITE": Num = 1 'black
Case Is = "RED": Num = 3 'red
Case Is = "BLACK": Num = 1 'black
Case Is = "YELLOW": Num = 6 'yellow
Case Is = "VIOLET": Num = 54 'violet
Case Is = "ROSE": Num = 38 'rose
Case Is = "AQUA": Num = 42 'aqua
End Select
'Apply the color
rng.Font.ColorIndex = Num
endit:
Application.EnableEvents = True
End Sub

"FP Novice" wrote:

Also, I am not using conditional formatting since the field can return any
one of twelve different text colors., I was thinking about defining the text
to color in VB but am not certain where to start.

"FP Novice" wrote:

In a lookup sheet I have made I set the cells that hold my formulas to be
locked on protection. These cells that I speak of change text color based on
the returned results from the lookup. My trouble shows up after I protect the
worksheet, once protected the cells no longer change text color based on the
returned results.

File can be provided for review.



All times are GMT +1. The time now is 11:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com