ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how can i change colour of a cell (https://www.excelbanter.com/excel-programming/428753-how-can-i-change-colour-cell.html)

lee

how can i change colour of a cell
 
on excel, how can you change the colour of a cell by putting a value in
another cell

Chip Pearson

how can i change colour of a cell
 
Conditional Formatting on the Format menu can do this. First, select
the cell whose color should change. Then, open the Conditional
Formatting dialog from the Format menu. There, change "Cell Value Is"
to "Formula Is" and enter something like the following in the formula
box:

=A110

Change that formula to return TRUE or FALSE, indicating whether the
format should be applied. Then click the Format button and choose the
Pattern tab. Select the color to fill the cell. Click OK until you're
done. If the formula is TRUE (e.g., A110), the format you selected
will be applied to the cell. If the formula is FALSE, no format (other
than the cell's default format) will be applied to the cell.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2009
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Wed, 20 May 2009 13:56:01 -0700, lee
wrote:

on excel, how can you change the colour of a cell by putting a value in
another cell


Patrick Molloy

how can i change colour of a cell
 
put this code in the sheet's code page (right click the tab & click View
Code)


Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
' cell D4 triggers a colr change in E4
If Target.Address = "$D$4" Then
If IsNumeric(Target.Value) Then
Select Case Target.Value
Case 1 To 56
Range("E4").Interior.ColorIndex = Target.Value
Case Else
End Select
End If
End If
End Sub

to see all available colors, put this code into a standard module

Option Explicit
Sub ListColors()
Dim i As Long
On Error GoTo Quit
i = 1
Do
Cells(i, 1) = i
Cells(i, 2).Interior.ColorIndex = i
i = i + 1
Loop
Quit:
End Sub

"lee" wrote in message
...
on excel, how can you change the colour of a cell by putting a value in
another cell




All times are GMT +1. The time now is 08:37 PM.

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