473,320 Members | 1,870 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Conditional Fomatting (>3 conditions)

Hi
I am trying to change the colour of cells based on the values of 2 other cells but I couldn't get the right VBA code for Excel 2003. Could you please help me with the following conditions:

if valueX<=2 and valueY<=2, green colour

if valueX>=4 and valueY>=4, red colour

otherwise, yellow colour.

There might be more similar conditions, therefore I want to use VB to handle more than 3 conditions.

Many thanks

Prakash
Mar 26 '08 #1
1 960
daniel aristidou
491 256MB
Hi
I am trying to change the colour of cells based on the values of 2 other cells but I couldn't get the right VBA code for Excel 2003. Could you please help me with the following conditions:

if valueX<=2 and valueY<=2, green colour

if valueX>=4 and valueY>=4, red colour

otherwise, yellow colour.

There might be more similar conditions, therefore I want to use VB to handle more than 3 conditions.

Many thanks

Prakash
TRy using
Expand|Select|Wrap|Line Numbers
  1. Dim num as cell.val
  2. Select Case  num
  3. Case num>2
  4. Cell.color = red
  5. Case num >3 
  6. Cell.Color = blue
  7. end select
  8. Etc
Mar 26 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Max | last post by:
Hi, I'm a perl programmer and am trying to learn PHP. So far I have figured out most of the differences, but have not been able to find out how to do the following: When running through a...
7
by: Guy Hocking | last post by:
Hi there, I have a problem in my ASP/SQL Server application i am developing, i hope you guys can help. I have a ASP form with list boxes populated by SQL tables. When a user selects a value...
3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
3
by: HateSpam | last post by:
I have a field on a form which shows a field with conditional formatting. From this form, it is possible to open another form where the user can update things which will affect the field with the...
2
by: Von Bailey | last post by:
I have a form where the conditional formatting is set on some fields to bold if certain conditions are met. However, when the conditions are met some of the data that is to bold is either not...
3
by: DFS | last post by:
Has anyone figured out how to apply more than 3 conditional formats to a datasheet (or continuous) view, or in lieu of that how to apply more than 3 conditional (based on a name) colors? I saw...
4
by: ApexData | last post by:
In a Continuous form, I want to use Conditional Formatting to change the background color of a date field based on a condition. 1-The color chart in the CF menu option offers limited colors. How...
20
Ericks
by: Ericks | last post by:
I want to apply Conditional Fomatting to a sub form's date control when it's of earlier date than a date in another table (form). I use following code in Expression is:...
1
by: mlgmlg | last post by:
Hello, I have a text box (on a Single Form) that I use to color code milestones based on a value. I use the “Conditional Formatting” tool to format four of the conditions, which works great! ...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.