Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default Auto Fill Color of a particular Cell if conditions are put

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto Fill Color Cell Steve Excel Worksheet Functions 1 July 15th 08 01:18 AM
How I auto fill a cell patern or color based on a pick list? bbjr Excel Discussion (Misc queries) 3 April 21st 08 07:50 PM
auto fill color of row capital letter Excel Worksheet Functions 4 November 7th 07 06:44 PM
auto fill color of row capital letter Excel Worksheet Functions 3 November 6th 07 01:49 PM
auto color fill cells Chopper New Users to Excel 6 March 6th 06 03:04 AM


All times are GMT +1. The time now is 04:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"