View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Akash Akash is offline
external usenet poster
 
Posts: 125
Default Auto Fill Color of a particular Cell if conditions are put

hii Bob,

thanks for the help but this is for your information that the following
code is not working

I have three columns

A B & C

i want the sum of A & B in C
More over I want that if the sum is greater than 50 but less that 60
the color of the cell should change to yellow and similar with other
conditions.

I want this type of program.

I hope i would definetely receive a solution from ur end.

Akash

On Jan 3, 2:31 pm, "Bob Phillips" wrote:
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A1:A10" '<=== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Range(WS_RANGE)) Is Nothing Then

With Target

Select Case .Value

Case 51 To 69: .Interior.ColorIndex = 6
Case 70 To 90: .Interior.ColorIndex = 3
Case Is 90: .Interior.ColorIndex = 5

End Select

End With

End If

ws_exit:
Application.EnableEvents = True
On Error GoTo 0

End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.

--
---
HTH

Bob

(change the xxxx to gmail if mailing direct)

"Akash" wrote in ooglegroups.com...

Hi,


Is it possible that after putting some condition like


if a cell value is more than 50 it should Fill the Cell with Yello
Color if more than than 70 it should be Green if more than 90 it
should be Red.


If this can be done. If yes, then how it can be done.


Awaiting for ur help in this regards


Akash