Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format cell color based on multiple variables


I am creating a spreadsheet that imports data from another sheet.
group of cells are to be assigned a color based on thier imported data
however, the color assignments need to be able to be defined and change
from a "key" which I want to locate on the page itself. see attached fo
example.

Any thoughts on a good way to go about doing this?
I have been playing with formulas all day. I can use conditiona
formatting but that only defines the color based on the number in th
cell and does not allow me to change the numerical color range from th
page itself.

Thoughts

+-------------------------------------------------------------------
|Filename: excel.JPG
|Download: http://www.excelforum.com/attachment.php?postid=4291
+-------------------------------------------------------------------

--
chuzi
-----------------------------------------------------------------------
chuzie's Profile: http://www.excelforum.com/member.php...fo&userid=3105
View this thread: http://www.excelforum.com/showthread.php?threadid=50725

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Format cell color based on multiple variables

Hi,
Here is simple possible solution. A named range ("Colours") contains
the upper limits of each band in your data AND is colour-coded i.e. filled
with required colour.

Macro then loops through cells and changes colours according to value in
"Colours" table.

Colours ==named range sorted in descending order
0.73
0.54
0.43
0.00

Sub assignColour()
lastrow = Cells(Rows.Count, "D").End(xlUp).Row
Set rng = Range("d1:d" & lastrow) ' <=== imported data
For Each cell In rng
For Each c In Range("colours") ' <=== Named range
If cell = c Then
cell.Interior.ColorIndex = c.Interior.ColorIndex
Exit For
End If
Next c
Next cell
End Sub

HTH

"chuzie" wrote:


I am creating a spreadsheet that imports data from another sheet. A
group of cells are to be assigned a color based on thier imported data,
however, the color assignments need to be able to be defined and changed
from a "key" which I want to locate on the page itself. see attached for
example.

Any thoughts on a good way to go about doing this?
I have been playing with formulas all day. I can use conditional
formatting but that only defines the color based on the number in the
cell and does not allow me to change the numerical color range from the
page itself.

Thoughts?


+-------------------------------------------------------------------+
|Filename: excel.JPG |
|Download: http://www.excelforum.com/attachment.php?postid=4291 |
+-------------------------------------------------------------------+

--
chuzie
------------------------------------------------------------------------
chuzie's Profile: http://www.excelforum.com/member.php...o&userid=31053
View this thread: http://www.excelforum.com/showthread...hreadid=507255


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Format cell color based on multiple variables


That makes perfect sense but I am not familiar with the code

lastrow = Cells(Rows.Count, "D").End(xlUp).Row


--
chuzie
------------------------------------------------------------------------
chuzie's Profile: http://www.excelforum.com/member.php...o&userid=31053
View this thread: http://www.excelforum.com/showthread...hreadid=507255

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Format cell color based on multiple variables

It finds the last (non-blank) row in the column (D in the example) so you can
define the range of data to process. If your range is fixed then there is no
need to use this but ranges usually vary in size (number of rows) so this
construct is frequently used.


HTH

"chuzie" wrote:


That makes perfect sense but I am not familiar with the code

lastrow = Cells(Rows.Count, "D").End(xlUp).Row


--
chuzie
------------------------------------------------------------------------
chuzie's Profile: http://www.excelforum.com/member.php...o&userid=31053
View this thread: http://www.excelforum.com/showthread...hreadid=507255


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
Format row color based on individual cell Beawesum Excel Discussion (Misc queries) 3 August 15th 08 08:09 PM
Conditional format a cell based on color of another Marlo Excel Discussion (Misc queries) 3 January 21st 08 01:50 AM
Format cell color based on multiple cell values Zenaida Excel Discussion (Misc queries) 1 May 10th 06 07:31 PM
Format cell color based on multiple cell values Zenaida Excel Discussion (Misc queries) 3 May 9th 06 11:56 PM
Change cell format based on its color Anders[_7_] Excel Programming 2 October 20th 05 02:57 PM


All times are GMT +1. The time now is 10:13 PM.

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

About Us

"It's about Microsoft Excel"