View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Roger on Excel Roger on Excel is offline
external usenet poster
 
Posts: 249
Default Making a cell a color using color numbers

Excellent Don.

Thanks very much for this

Best regards, Roger



"Don Guillett" wrote:


Private Sub Worksheet_Change(ByVal Target As Range)

if target.address<"$B$1" then exit sub
'don't forget $ or " " and use CAPS for cell address

On Error Resume Next
If IsNumeric(Target) Then
Target.Interior.ColorIndex = Target.Value
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roger on Excel" wrote in message
...
Hi Don,

Nice - it works well.

by the way, how would i restrict this to cell "b1"?

Thanks,

Roger



"Don Guillett" wrote:

Right click sheet tabview codecopy/paste this. You may want to restrict
the cells involved.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If IsNumeric(Target) Then
Target.Interior.ColorIndex = Target.Value
End If
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Roger on Excel" wrote in
message
...
Is it possible to enter a color number (1-56 for example) and make that
cell
the color in question?

I am guessing conditional formatting might be a way, but i think some
code
may be needed.

Can anyone help?

Thanks,

Roger