Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / General Excel Questions / March 2008

Tip: Looking for answers? Try searching our database.

Colors for entries

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ille - 27 Mar 2008 14:19 GMT
Hi All,
I'm working wiht Excel 2003 and trying to set up a form. I will allow
entries to be selected from a list - so far no problem. Is it possible to
format the entries in advance, i.e. that for example, if you selcet "name"
from the list, it will appear in red?
Thanks for your help
Signature

Ille

Joel - 27 Mar 2008 17:37 GMT
Conditional formating will allow you to select a difffeent color for up to 3
different items.  If your listt is greater than 3 you require a macro.

> Hi All,
> I'm working wiht Excel 2003 and trying to set up a form. I will allow
> entries to be selected from a list - so far no problem. Is it possible to
> format the entries in advance, i.e. that for example, if you selcet "name"
> from the list, it will appear in red?
> Thanks for your help
Ille - 27 Mar 2008 17:59 GMT
Unfortunately my list is longer ... no idea how to use a macro. Anyway
thanks a lot.
Signature

Ille

> Conditional formating will allow you to select a difffeent color for up to 3
> different items.  If your listt is greater than 3 you require a macro.
[quoted text clipped - 5 lines]
> > from the list, it will appear in red?
> > Thanks for your help
Gord Dibben - 27 Mar 2008 23:11 GMT
Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
   Set vRngInput = Intersect(Target, Range("D1,E1,F1,G1"))
   If vRngInput Is Nothing Then Exit Sub
       On Error GoTo endit
   Application.EnableEvents = False
   For Each rng In vRngInput
   'Determine the color
       Select Case rng.Value
       Case Is = "Able": Num = 10    'green
       Case Is = "Baker": Num = 1    'black
       Case Is = "Charie": Num = 5    'blue
       Case Is = "Doofus": Num = 7    'magenta
       Case Is = "Edgar": Num = 46    'orange
       Case Is = "Francis": Num = 3       'red
       End Select
   'Apply the color
   rng.Interior.ColorIndex = Num
   Next rng
endit:
       Application.EnableEvents = True
End Sub

This is sheet event code.  Right-click on the sheet tab and "View Code".

Copy/paste the code into that sheet module.

Adjust range, names and colors to suit.

Gord Dibben  MS Excel MVP

> Unfortunately my list is longer ... no idea how to use a macro. Anyway
>thanks a lot.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.