#1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 1
Default Colours

All i want to know is say you have a drop down list with
numbers 1, 2 and 3 then when you select 1 it makes the
whole row blue, select 2 it makes the whole row green,
select 3 it makes the whole row red.
I know how to make lists etc but not how to make it
automaticaly change the row colour.

Please Help

Sam
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Colours

One approach is to put the following in the combobox change event code
(reached by double clicking on the combo box:

Private Sub ComboBox1_Change()
Dim iColor As Integer
Select Case Me.ComboBox1.value
Case 1: iColor = 5
Case 2: iColor = 4
Case 3: iColor = 3
End Select
If Me.ComboBox1.ListIndex = 0 Then
ActiveCell.EntireRow.Interior.ColorIndex = iColor
End If
End Sub

The values of the colors were obtained by using the macro recorded.

Bob Flanagan
Macro Systems
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Sam" wrote in message
...
All i want to know is say you have a drop down list with
numbers 1, 2 and 3 then when you select 1 it makes the
whole row blue, select 2 it makes the whole row green,
select 3 it makes the whole row red.
I know how to make lists etc but not how to make it
automaticaly change the row colour.

Please Help

Sam



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Colours


-----Original Message-----
All i want to know is say you have a drop down list with
numbers 1, 2 and 3 then when you select 1 it makes the
whole row blue, select 2 it makes the whole row green,
select 3 it makes the whole row red.
I know how to make lists etc but not how to make it
automaticaly change the row colour.

Please Help

Sam
.
Another method for a non VB user might be...


Use conditional formating.

Example if the drop down was in A then select the row that
you want to formatt and then click Format/Conditional
Formatting Then chnage the condition 1 to formula and type
this formula in "=A1=1" then use the format button to
select the format you want... in thios case "red"

Then go on top condition 2 and again select formula as the
condition and type this formula "=A1=2" then use the
format button to determine the format to display when A1
is equal to 2 and so on.

HTH

Kelly

O ya I am using Excel 2000, not sure if it works on all
versions.
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
How can I customise colours used in charts and keep those colours. LJ Charts and Charting in Excel 3 May 20th 10 01:50 PM
How to save one of the MORE COLOURS in the THEME COLOURS? Wulfy Excel Discussion (Misc queries) 0 August 18th 09 10:25 AM
Colours Man Excel Discussion (Misc queries) 10 August 4th 07 02:01 AM
Colours debbym Excel Discussion (Misc queries) 2 March 28th 07 11:12 PM
Excel 2003 font colours and cell colours bretta Excel Discussion (Misc queries) 1 April 17th 05 03:45 AM


All times are GMT +1. The time now is 01:43 PM.

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

About Us

"It's about Microsoft Excel"