View Single Post
  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default Auto color-shading of rows

Fitz,

Remove this code

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Target.Column = 13 Then
With Target
Select Case .Value
Case 424: .EntireRow.Interior.ColorIndex = 6
Case 426: .EntireRow.Interior.ColorIndex = 35
Case 436: .EntireRow.Interior.ColorIndex = 41
Case "TAU": .EntireRow.Interior.ColorIndex = 45
'etc
End Select
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub


replace it with this code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Column = 6 Then
Select Case .Value
Case 436: .EntireRow.Interior.ColorIndex = 6
Case 437: .EntireRow.Interior.ColorIndex = 5
'etc
End Select
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub

The only way you can avoid the message is to set your security setting to
low, which I don't advise, or digitally sign it. I haven't done this, but it
is described at

Note that certification only works in Excel 2000 and later.

http://msdn.microsoft.com/library/de.../odc_dsvba.asp
Code Signing Office XP Visual Basic for Applications Macro Projects

http://msdn.microsoft.com/library/de...tml/combat.asp
Combat Macro Viruses with Digital Signatures

Another reference:
http://msdn.microsoft.com/library/en...vbaproject.asp

http://office.microsoft.com/assistan...ustworthy.aspx
How to Tell if Digital Certificate Is Trustworthy in Office XP

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Fitz" wrote in message
.. .
Just to get this all back on track, because I copied and pasted wrong

code,
do I now have to delete any code that I have in there already? If so,

where
do I delete?Secondly, on the one sheet that I'm interested in getting the
rows to be highlighted (tabbed "CC130"), the column of interest is column

F.
In column F there will be four possible entries as outlined below:

-if "424" is written in a cell in column F then the row, in its entirety,
associated with that "424"cell will be highlighted in YELLOW
- if "426" is written in that same column in any particular cell then the
complete row associated with that cell would be hightlighted in LIGHT

GREEN,
-if "436" is written in that same column in any particular cell then the
complete row associated with that cell would be hightlighted in LIGHT

BLUE,
-if "TAU" is written in that same column in any particular cell then the

row
associated with that cell would be hightlighted in LIGHT ORANGE.

I only need this highlighting to work on this one particular worksheet in
the workbook.
When I insert any code it appears to be viewing this as a macro and Excel
wants me to enable macros. How do I tell excel that this macro is written

by
a trusted publisher so it will run behind the scenes everytime I open this
file without asking me to enable macros all over again?
Please just restate the exact code required for this scenario because the
latest does not seem to address a specific column (ie. F or 6) nor does it
include two of the four possible cell input possibilities listed above.

Thanks for your patience.