How do I set a colour to 4 cells based on the value of a cell

I want to assign a colour to a group of 4 cells (ie a1 to a4) based on the 
colour that is typed into another cell (ie d1). It could be that I need the 
option of using 10 colours.
eg if d1 was "green" then a1-a4 would be coloured green.

0
Andy64 (1)
9/6/2005 4:00:22 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
363 Views

Similar Articles

[PageSpeed] 51

Andy

For greater than 3 colors(4 if use default no color) you will need VBA.

Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
    Set rng1 = Intersect(Target, Range("D1"))
    If rng1 Is Nothing Then Exit Sub
        On Error GoTo endit
    Application.EnableEvents = False
    Set rng2 = Range("A1:A4")
    'Determine the color
        Select Case rng1.Value
        Case Is = "green": Num = 10    'green
        Case Is = "black": Num = 1    'black
        Case Is = "blue": Num = 5    'blue
        Case Is = "magenta": Num = 7    'magenta
        Case Is = "orange": Num = 46    'orange
        Case Is = "red": Num = 3       'red
'add more cases as you wish
        End Select
       rng2.Interior.ColorIndex = Num
endit:
        Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code".  Copy/paste the code into that
module.

Note: Data Validation>List can be used to enter the value into D1.


Gord Dibben Excel MVP


On Tue, 6 Sep 2005 09:00:22 -0700, Andy64 <Andy64@discussions.microsoft.com>
wrote:

>I want to assign a colour to a group of 4 cells (ie a1 to a4) based on the 
>colour that is typed into another cell (ie d1). It could be that I need the 
>option of using 10 colours.
>eg if d1 was "green" then a1-a4 would be coloured green.

0
Gord
9/6/2005 5:46:46 PM
Reply:

Similar Artilces:

setting up new outlook mail account
i can not set up a new account on my outlook, i keep saying establish network connection with a correct sign but searching for my mail account shows X can you please advise Are you trying to setup a POP3 mail account or an Exchange account? Also, what version of Outlook are you using? "rashid" <rashid@discussions.microsoft.com> wrote in message news:C59D04C0-C1C9-4BD1-AE00-2009D25B221D@microsoft.com... > i can not set up a new account on my outlook, i keep saying establish > network > connection with a correct sign but searching for my mail account shows X > ...

How do I set up an argument which asks for multiple criteria
I am trying to use an argument that asks for one of three criteria (2345P, 8319T, or 7026J) in cell C108, and if it finds it, enters the amount of yet another cell, G108 into cell K108, and if not enters 0 into cell K108. It seems there are too many arguments for the "if" argument, and I can't seem to get the "lookup" argument to work either. Is there another argument I should be working with? Thanks -- Diver Try: =IF(OR(C108="8319T",C108="2345P",C108="7026J"),G108,0) "bj" wrote: > try in K108 > =if(or(c108=&qu...

Inserting time inside cell
I use Office 2003 Excel Win XP Can someone tell me how to insert time: hours, minutes and seconds inside a cell? sn hi, hh:mm:ss or 12:12:12 also see Format>cells>number tab. scroll down left to custom. scroll down right to see other formats. regards FSt1 "Sachi Noma" wrote: > I use Office 2003 Excel Win XP > > Can someone tell me how to insert time: hours, minutes and seconds inside a > cell? > > sn > > Hi Sachi, Not sure if this is what you are looking for but if you hit ctrl+; in a cell it will put the current date in that cell, i...

OWA Set Rule problem
I have successfully install the Exchange 2003 with SP1 in the Windows Server 2003. Anything alright exclude the rules function in OWA. I try to set the rules from any then "move to" or "copy to" specify folder are no problem, but "forward to" other email address, its don't work. I try to input the email address in the contact and then select from the contact, but the result also don't work. The rules can save and I can receive the incoming email in the Exchange 2003/Outlook or OWA, but it don't forward to my specify email address. I try to...

How do I set the 'Set Synchronizing Client' field
We have a number of outlook clients using CRM that have the 'Set Synchronizing Client' select box greyed out. We need to tick them so that they are able to synchronize tasks etc. Can any one help me find out why these are greyed out and then set them so that they can synchronize thanks In my experience, that checkbox is always greyed out for the first install that is performed for a user. The only time that checkbox becomes active is if a second copy of CRM is installed for a user who already has CRM installed on another PC.... Normally the box is checked and grey. If that is...

Office 2004 Test Drive #4
Hi Friends I just got my new MAcbook Pro and was taking it for a test drive when I came to a screeching halt. It seems my clock was set for the wrong time zone which was past midnight and hence was registering Tuesday when it was still Monday. I had already started the test drive for office 2004 and then when I was playing around and notice the time was not correct I set it. After that since the date was now one day earier my Office 2004 would not run. even though it is ow Tuesday it still will not run it tells me that it is expired (after 2 hours) is there any help for this. I am afraid...

How do I make a cell appear empty when the formula = 0?
If the answer to the formula is 0, how can I make it just show the cell as empty instead of actually putting a 0 in the cell? =if(yourformulahere=0,"",yourformulahere) t1202 wrote: > > If the answer to the formula is 0, how can I make it just show the cell as > empty instead of actually putting a 0 in the cell? -- Dave Peterson In say A1 =IF(B1+B2=0,"",B1+B2) Regards, Alan "t1202" <t1202@discussions.microsoft.com> wrote in message news:FE8FD529-9AA3-484D-BEE1-40332E97A2A9@microsoft.com... > If the answer to the formula is 0, how can I ...

CRM 4.0
Hi; We have a customer that would like to run CRM 4 on 32-bit Windows and then add a new 64-bit app server, and point to the same organization. The end-game is to soon thereafter retire the 32-bit box, but is anyone aware of any problems having the 2 mixed-architecture servers running at the same time? Thanks, Dave Ireland Shouldn't be a problem. Check out section 3.1.7 of the CRM 4 Planning guide for more information on 32 bit and 64 configurations for App Server, SQL, SQL Connector, OS, etc. I just moved a 32 bit sql database to a 64 bit box while keeping the 32 bit app s...

How to set backcolour
Hello All I have a continuous form containing a number field (long integer) called [v_colour]. This field contains the number of a certain colour - as per the numbers that are used in the format properties for back colour etc. I would like to set the back colour for the form's [v_colour] text box to be the value of the field: e.g. If the value of [v_colour] in the first record is 255, I want the back colour of the textbox for that record to be bright red. I tried this as the OnLoad event for the form: [v_colour].backcolour = [v_colour].value .... but this resulted in the back colour of...

How to keep a cell empty at the same time formula embedded?
Can we have an empty cell but formula embedded in that cell. A cell cannot be both "empty" and contain something...........you can however, put a formula there that will display a blank cell according to the conditions of it's calculations........... =(IF(A1>5,A1,"")......will display a blank cell if A1 is 5 or less Vaya con Dios, Chuck, CABGx3 "vic_dic" <vic_dic@discussions.microsoft.com> wrote in message news:A590D8A6-7E86-49B7-AA9A-12DE213E670C@microsoft.com... > Can we have an empty cell but formula embedded in that cell. What are you...

Applying Percent Decrease Across Set Periods
I have a column which includes dates when items were purchased. I have used the DATEDIF function to find the number of years between that date and today's date. I now want to decrease the purchase amount 10% for every year calculated via the DATEDIF function. Any ideas, is this possible, why can't I think...? -- Hunt&amp;Peck ------------------------------------------------------------------------ Hunt&amp;Peck's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=32961 View this thread: http://www.excelforum.com/showthread.php?threadid=527873 ...

Set Regional Settings but not Language
Hi I have a multi-language APP en-US, es-ES, it-IT I usually change Languages and Locales by using the CultureInfo to switch Languages System.Globalization.CultureInfo myCI = new System.Globalization.CultureInfo("es-ES"); My issue is - what if the user wants to View App in english and use the Regional Options on a PC in say Spain ??? If I change the CultureInfo to en-US then they can view APP in English ( English satelite assemblies) but date and numbers will be in US format If I change the CultureInfo to es-ES then date and numbers will be in Spain forma...

Error Install BP 4.0
Hi i Have the following Virtual Envioroment W2003 Enterprised R2 SQL-2005 Pck 2 GP-10 Pck2. WSS 3.0 I'm on local machine and the error is the following !Installer Information! An Error ocurred while applying security settings. nt authority\network services is not a valid user or group. This could be a problem with the package, or a problem connecting to a domain controller on the network. Check your network connection and click retry, or cancel to end install. Please, give a hint!!!! Jaime O. ...

Search cells with many numbers a few numbers?
In Excel, I'd like to search cells which have many numbers in each, they are separated by spaces. I'd like to look in the cells for a few numbers. The logic statements do not seem to work. How do I do this? ...

Reading Pane Settings
I did a search for an answer to this question and have not found one. If I missed an answer already posted, please direct me to the right place. I have Outlook 2007 and set up the "right" reading pane for my e-mail. Now when I go to my calendar it is set up the same way - calendar on the left (same size as the inbox) and then there is a blank space to the right that is the size of the reading pane/preview. To the right is the to-do bar (which I have no problem with). I don't know why there is a reading/preview pane on the calendar when there is nothing to preview, and I...

Work Hours setting excludes specified hours from Scheduling
I am miffed by this problem. I specify a work hour schedule for a user. When I schedule a CRM User as a Resource for a Service in Scheduling of a Service Activity with Requested Time of ASAP and click Find Available Times, the values for Avilable Times returned are outside of the Work Hours I specified for the user and not within the work hours. When I drill into the Work Hours for this User, the Calendar view shows Cross Day rather than 8:00AM - 5:00PM I speciied for work hours and editing the hours reveal the correct hours in the Work Hours. What gives? Never mind. Figured out w...

Freezing contents of a cell
I have a cell (A4) that copies the results of a formula in another cell (B8). When B8 changes, I want A4 to keep its original results. Is this possible? Thanks, Barney Yes, have a look at the freeze pane function. It takes a cell co-ordinate and freezes on the cell. -- Regards, Alvin Bruney [Shameless Author Plug] The Microsoft Office Web Components Black Book with .NET available at www.lulu.com/owc ------------------------------------------------------------ "Barney" <postonbl@yahoo.com> wrote in message news:OB#mmsSIFHA.1392@TK2MSFTNGP10.phx.gbl... > I have a c...

Need to sum values that are not strikethroughs
I need to sum a column without it adding the rows that have strikethroughs values; is it possible to combine a formula and vb code to a cell ? =SUM(BH100:BH120) & Activecell.selection.font.strikethrough = false Thank you Khf Try: Function zum(r As Range) As Double Dim rr As Range For Each rr In r If rr.Font.Strikethrough = False Then zum = zum + rr.Value End If Next End Function In the worksheet use it like: =zum(A1:A10) -- Gary''s Student "Rock" wrote: > I need to sum a column without it adding the rows that have strikethroughs > values; i...

Outlook "Arrange By" option does not retain its setting
In outlook 2007, I use a custom view for my inbox, and I have the Group By option checked to"Automatically group according to arrangement." This has been workn flawlessly until today, when I realized Outlook did not like a particular mouse click; perhaps I clicked on the border of two options or some other anomoly that caused the window toflash once. The end result was that my Arrange By option changed to "From" when I had previously set it to "Conversation." Now, whenever I hange it backto "Conversation," leave the inbox and come back, ...

How do I color specific data series based on location on data she
I have about 150 data series in a chart and I want to color e.g. 10 of them red based on where in the data sheet they are located, e.g. data i column J to T. Is there an easy way to do this? Format one of them the way you want. Select the other series you want to change and press F4. This may be difficult with 150 series, however. "Havard" <Havard@discussions.microsoft.com> wrote in message news:8F62297E-447B-4507-8D4A-A2C9A38C08EA@microsoft.com... > I have about 150 data series in a chart and I want to color e.g. 10 of them > red based on where in the data sheet ...

format a cell
does anybody know how i can format a cell so that it looks like its raise. thanks in advance. One play to tinker with Either switch-off the gridlines (Tools > Options > View tab > Uncheck gridlines > OK) or press CTRL + A (select entire sheet) then click to Fill color > white Select the cell(s) Click Format > Cells > Border tab Select the thickest solid line in "Style" Click to format either the right & bottom or the left & top borders Select the thinnest solid line in "Style" Click to format the remaining 2 borders Click OK -- Rgds...

How do I set OOR
I have searched the help menu and have had no luck finding out how to set my outlook 200 to send an OOR (Out of Office Reply) Any assistance would be great If you are in an Exchange environment (ask your administrator if you do notknow) you can set the Out of the Office Assistant which is located under Tools. If you are not in an Exchange environment you can create a rule that replies on all e-mails. The downside of this is that you'll have to have your Outlook open all the time for the rules to process. Make sure you set some exceptions (for instance based on the subject field so ...

interactive buttons, multiple sets
hi folks I'm sure one of you good folks will save my bacon as usual I have a series of websites, all of which exhibit the same odd behavior with interactive buttons. I have a bunch of buttons in the left margin, each of which pulls up ( lets call it ) a chapter, and in each 'chapter' are a number of related pages. On the top of each page is an imbedded page which has 'page numbers' for all the 'pages' in that chapter. So, it's a grid where the 'vertical' buttons in the left margin and the 'horizontal' buttons at the top comb...

Set Focus
I have text box that I input data into and I was wondering if it is possible to set focus to the text box and avoid clicking on the box. I thought the term is Set Focus, but can't find any information or example that would help in doing so. Any help would be appreciated .. PPT 2003. Look at the following page for code to set focus on a text box: http://officeone.mvps.org/vba/activate_shape.html - Chirag PowerShow - View multiple PowerPoint slide shows simultaneously http://officeone.mvps.org/powershow/powershow.html "Phil K" <PhilK@discussions.microsof...

What is the formula for getting time difference e.g. ("4 hrs 15 m.
I have 2 rows - one has a start time and other has the end time. In the third row, i want to display the difference between two times. And it should come in this manner... "4 hrs 15 min".. what would be the exact formula? Regards sandeep A B C 1 Start Time End Time Delta 2 8:00 10:20 =B2-A2 You'll then have to format the C column to have time in the format you want. "Sandeep Manjrekar" <SandeepManjrekar@discussions.microsoft.com> wrote in message news:3AA54934-E119-46AE-8822-E...