PDA

View Full Version : IF Formula



Gordon Scott
10-16-2006, 08:05 AM
Could someone please tell me the IF formula that if cell A2 = 1 or any other number i choose it will colour that row a colour of my choice and how do i choose the colour from the palate.

Thanks
Gordon

SamT
10-16-2006, 08:26 AM
Why not use Conditional Formatting?

Click MenuBar > Format > ConditionalFormating.

SamT

lucas
10-16-2006, 08:41 AM
VBA solution.....This might work to look for the number 2 in column A and highlight that row:

Sub Test()
Dim c As Object

For Each c In Range("a1:a28")
If c.Value = 2 Then
c.EntireRow.Interior.ColorIndex = 6
Else
c.EntireRow.Interior.ColorIndex = xlNone
End If
Next
End Sub

Gordon Scott
10-18-2006, 12:46 AM
Lucus

Thanks for that, a few questions though, I have 9 numbers and each number represents a different colour, can i add more numbers in and can it run automatically without having to hit the run macro and can i add it to this existing macro.

Thanks

Gordon

Bob Phillips
10-18-2006, 01:53 AM
See http://www.xldynamic.com/source/xld.CF.html

Charlize
10-18-2006, 03:00 AM
A possible way to go. Attached a zip to show the idea.

Charlize

Gordon Scott
10-18-2006, 03:18 AM
Charlize

Excellent, just what i need but how do i get the excact colours to match my numbers 1 to 9. Is there a list of colour names somewhere?

Many thanks

Gordon

Charlize
10-18-2006, 03:23 AM
You could try this link : http://www.tayloredmktg.com/rgb/

Charlize

lucas
10-18-2006, 07:04 AM
Charlize

Excellent, just what i need but how do i get the excact colours to match my numbers 1 to 9. Is there a list of colour names somewhere?

Many thanks

Gordon

Try this old one from Zack