Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Conditional formating

Hi again...I must be very slow today as I can not make that work
Could/would you please show me the required code for there following.
if I enter a value under 20 I want that cell background to turn red and if
it is 20 or over the cell would turn blue.
Many thanks in advance.
Ian M
"Frank Kabel" wrote in message
...
Hi
the first VBA statement just checks that only ONE cell is changed (and
not mutiple cells at the same time)

--
Regards
Frank Kabel
Frankfurt, Germany


PCOR wrote:
Thanks for the quick response
The first part of your answer works very well to change the font
colors.
I am afraid that I do not understand the code you have under
WORKSHEET_change
The first line "If Target.Cells.Count 1 Then Exit Sub" seems to
imply that is the cell contains a number greater than 1, then exit
the sub
If that is the right way of reading that statement, I don't see how
the rest of the code will ever be executed
I sure hope that you can help me with this problem
Thanks
Ian M


"Frank Kabel" wrote in message
...
Hi
conditional format only accepts 3 conditions though you have a

fourth
if you include the default format.

If you only want to apply different FONT colors based on NUMBERS,

you
can define up to 6 different styles. See:
http://www.mcgimpsey.com/excel/conditional6.html
for instructions how to do it

For everything else you'll need VBA code (e.g. process the
worksheet_change event and apply your format based on the cell
values). The following will color the entry in cell A1:A100 based on
its value:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count 1 Then Exit Sub
If Intersect(Target, Me.Range("A1:A100")) Is Nothing Then Exit
Sub On Error GoTo CleanUp
Application.EnableEvents = False
With Target
Select Case .Value
Case "Red": .Interior.ColorIndex = 3
Case "Blue": .Interior.ColorIndex = 10
'etc.
End Select
End With
CleanUp:
Application.EnableEvents = True
End Sub



--
Regards
Frank Kabel
Frankfurt, Germany


PCOR wrote:
Currnetly you can conditional format at cell for up to 3 conditions
Example under 40=red, 41 to 100 = blue and over 101= orange
Is there a way to add a fouth condition? Say under 39 = green
Thanks




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
Conditional Formating Kanmi Excel Worksheet Functions 1 July 15th 09 04:33 AM
Conditional Formating Gazz_85[_2_] Excel Discussion (Misc queries) 13 July 6th 09 08:24 AM
conditional formating - Help Kinghart Excel Worksheet Functions 4 November 17th 08 03:20 AM
Install dates formating using conditional formating? Jerry Eggleston Excel Discussion (Misc queries) 2 November 9th 05 05:49 PM
Conditional Formating Bassett Excel Discussion (Misc queries) 1 May 15th 05 04:02 PM


All times are GMT +1. The time now is 07:46 PM.

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"