Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Want add color to the cell depending on the value selected from th

Use the change event:

Chip Pearson's page on Events
http://www.cpearson.com/excel/events.htm


Private Sub Worksheet_Change(ByVal Target As Range)
Dim v as Variant
v = Array(3, 4,5,8,6)
if not Intersect(target,Range("B9:B20")) is nothing then
if Target.Value 0 and Target.Value < 6
Target.Interior.ColorIndex = v(Target.Value-1)
end if
end if
End Sub

--
Regards,
Tom Ogilvy


Right click on the sheet tab and select view code. Put in code like the
above.
"viksha" wrote in message
...
Hi,

I have defined a dropdown, by using a DataValidationList..

Now it has got 5 values say 1 ,2 ,3, 4 and 5

Now my requirement is , I wnat to change the color of the cell depending

on
the value I select from the text.say if 1 is selected then it should be

red
and 2 is selected it should be greeen and so on..

I tried using FORMATCONTIONAL..but this is restricted to only 4 , I have
condtion to check for more than 4 say 5 or 6..

Looking forward for reply.
--
Programmin



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
color after depending on 1st value in a cell pedy Excel Discussion (Misc queries) 1 July 3rd 09 11:29 PM
Tab Color Changes depending on value of a cell Thiago Excel Discussion (Misc queries) 1 September 10th 08 01:30 PM
Can I show a picture depending on what data is selected in a cell Lesley Murray Excel Discussion (Misc queries) 3 April 12th 07 04:34 PM
Cell color depending on statement kvadre Excel Discussion (Misc queries) 3 August 2nd 06 03:38 PM
Sum depending on cell background color gwag17 Excel Programming 3 July 12th 04 02:24 PM


All times are GMT +1. The time now is 07:59 AM.

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"