ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How many conditions can I apply to a cell? I need to apply 8. (https://www.excelbanter.com/excel-discussion-misc-queries/194339-how-many-conditions-can-i-apply-cell-i-need-apply-8-a.html)

markus

How many conditions can I apply to a cell? I need to apply 8.
 
I have a annual leave spreadsheet where I want the user to enter a number
from 1-8 which will change the colour of the cell. Is this possible? How many
conditions can I apply to a cell? I need to apply 8.

Thanks in advance

Markus

Mike H

How many conditions can I apply to a cell? I need to apply 8.
 
Hi,

One way. Right click your sheet tab, view code and paste this in. Play with
the colours to get what you require.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Or IsEmpty(Target) Then Exit Sub
If Target.Address = "$A$1" Then
Select Case Target.Value
Case Is = 1
icolour = 3
Case Is = 2
icolour = 4
Case Is = 3
icolour = 5
Case Is = 4
icolour = 6
Case Is = 5
icolour = 7
Case Is = 6
icolour = 8
Case Is = 7
icolour = 9
Case Is = 8
icolour = 10
Case Else
icolour = xlNone
End Select
Target.Interior.ColorIndex = icolour

End If
End Sub

Mike

"Markus" wrote:

I have a annual leave spreadsheet where I want the user to enter a number
from 1-8 which will change the colour of the cell. Is this possible? How many
conditions can I apply to a cell? I need to apply 8.

Thanks in advance

Markus


David Biddulph[_2_]

How many conditions can I apply to a cell? I need to apply 8.
 
With Excel 2003, only 3 conditions (plus the base formatting).
If you want more than that, either Excel 2007 or VBA
http://www.ozgrid.com/VBA/excel-cond...ting-limit.htm
--
David Biddulph

"Markus" wrote in message
...
I have a annual leave spreadsheet where I want the user to enter a number
from 1-8 which will change the colour of the cell. Is this possible? How
many
conditions can I apply to a cell? I need to apply 8.

Thanks in advance

Markus





All times are GMT +1. The time now is 01:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com