View Single Post
  #2   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

Hi,

Thanks for the solution, the macro which u had given to me is working
very fine. But i want that the macro should run autometically, I mean
to say that i dont want to press the shortcut key every time to run the
macro.

i want the product of A & B in Column C

Now i want that if the product of coulmn C is between 51 To 69 then it
should be yellow in color and if the product is beween 70 To 90 it
should be autometically green color and if greater than 90 then it
should be Red Color.

I dont want to run the macro everytime. By you solution i have to run
it evertime after i calculate the value. Its not comming autometically.

Pls do help me by giving proper solution.

Regards

Akash

On Jan 3, 11:23 am, "MrScience" wrote:
Note: This assumes you have contiguous data in column "A." You can
modify as necessary.

Sub fillBasedOnValue()

Dim myCell As Variant
Set myCell = Range("A2")

Do While Not IsEmpty(myCell)
Set nextcell = myCell.Offset(1, 0)

Select Case myCell

Case 51 To 69
myCell.Interior.Color = vbYellow

Case 70 To 90
myCell.Interior.Color = vbGreen

Case Is 90
myCell.Interior.Color = vbRed

End Select

Set myCell = nextcell

Loop

MsgBox "File Done"

End Sub