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

I am trying to make a conditional formatting that is similar to the Conditional Formatting that is included in Excel. The only difference is that I need to have about 10 different conditions that I would like to test, and format.

The formatting is based on "Live Prices" in my worksheet that is updated continously. If the prices go below or above certain levels (Other predefined cells in the worksheet) I want the colour of the cells to change. The conditional Formatting in Excel would be perfect, but it is only 3 conditions to test, and I need about 10 different conditions to test. Anyone have any idea of how I could solve this problem?

--
Peter B
Norway
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Conditional Formatting

Peter

You can use event code in your worksheet....

Example

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target, Range("A:A"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is <= 0: Num = 10 'green
Case 0 To 5: Num = 1 'black
Case 5 To 10: Num = 5 'blue
Case 10 To 15: Num = 7 'magenta
Case 15 To 20: Num = 46 'orange
Case Is 20: Num = 3 'red
End Select
'Apply the color
rng.Font.ColorIndex = Num
Next rng
End Sub

Gord Dibben Excel MVP

On Thu, 17 Jun 2004 01:07:01 -0700, "Peter B"
wrote:

I am trying to make a conditional formatting that is similar to the Conditional Formatting that is included in Excel. The only difference is that I need to have about 10 different conditions that I would like to test, and format.

The formatting is based on "Live Prices" in my worksheet that is updated continously. If the prices go below or above certain levels (Other predefined cells in the worksheet) I want the colour of the cells to change. The conditional Formatting in Excel would be perfect, but it is only 3 conditions to test, and I need about 10 different conditions to test. Anyone have any idea of how I could solve this problem?


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
How can I convert conditional formatting into explicit formatting? Patrick Harris Excel Discussion (Misc queries) 0 April 9th 09 12:00 AM
Formatting Conditional Formatting Icon Sets The Rook[_2_] Excel Discussion (Misc queries) 3 March 7th 09 08:48 PM
Formatting cells in a column with conditional formatting? shamor Excel Discussion (Misc queries) 8 May 19th 08 10:11 PM
Protect Cell Formatting including Conditional Formatting Mick Jennings Excel Discussion (Misc queries) 5 November 13th 07 05:32 PM
Conditional Formatting that will display conditional data BrainFart Excel Worksheet Functions 1 September 13th 05 05:45 PM


All times are GMT +1. The time now is 05:45 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"