Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 24
Default Conditional Formatting

How would I apply conditional formats (up to 9 types) where the format is
applied to a range of cells but not the cell with the controlling condition.

eg. if cell A9=1 cells A1:A7 format as yellow
if cell A9=2 cells A1:A7 format as blue
etc.....for 9 different colours

Ther must also be an allowance for the target cell to have 'blank' and no
formatting applies
if cell A9=' ' cells A1:A7 have no fomatting

In all cases the cell with the controlling condition will be to the
immediate right (on the same row) as the cells that the formatting is to be
applied to

note: I have seen the add-in that allows up to 30 conditional formats but I
am on a controlled system and cannot install this (I have already asked IT
and they have refused)

Any and all suggestions welcome
Regards
Geoff (Oldersox)
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,355
Default Conditional Formatting

If you are using Excel 2007, you can do this fairly easily. If you're on
2003, you'll have to do it with VBA. For now, I'm going to assume it's 2003.

Right click on the worksheet tab of interest and select View Source. Paste
this in.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange As Range
Dim myColorIndex As XlColorIndex
Set myRange = Me.Range("A1:A7")

If Intersect(Target, Me.Range("A9")) Is Nothing Then Exit Sub

'Find the colorindex colors here
'http://www.mvps.org/dmcritchie/excel/colors.htm

Select Case Me.Range("A9")
Case 1
myColorIndex = 6
Case 2
myColorIndex = 5
Case 3
myColorIndex = 4
Case 4
myColorIndex = 3
Case 5
myColorIndex = 36
Case 6
myColorIndex = 35
Case 7
myColorIndex = 34
Case 8
myColorIndex = 33
Case 9
myColorIndex = 32
Case Else
myColorIndex = xlColorIndexNone
End Select

myRange.Interior.ColorIndex = myColorIndex

End Sub


--
HTH,
Barb Reinhardt



"Oldersox" wrote:

How would I apply conditional formats (up to 9 types) where the format is
applied to a range of cells but not the cell with the controlling condition.

eg. if cell A9=1 cells A1:A7 format as yellow
if cell A9=2 cells A1:A7 format as blue
etc.....for 9 different colours

Ther must also be an allowance for the target cell to have 'blank' and no
formatting applies
if cell A9=' ' cells A1:A7 have no fomatting

In all cases the cell with the controlling condition will be to the
immediate right (on the same row) as the cells that the formatting is to be
applied to

note: I have seen the add-in that allows up to 30 conditional formats but I
am on a controlled system and cannot install this (I have already asked IT
and they have refused)

Any and all suggestions welcome
Regards
Geoff (Oldersox)

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
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 3 January 20th 07 02:02 PM
conditional Formatting based on cell formatting Totom Excel Worksheet Functions 0 January 15th 07 04:35 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 08:42 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"