473,395 Members | 1,422 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,395 software developers and data experts.

Conditional formatting with Iserror

20
I'm trying to change the background color of cell B15 to red if any of the following cells is an error M15, O15, Q15, or S15. I know i can do it with conditional formatting but conditional formatting does not let you include more than three criteria. if your solution involves a macro do not worry about triggring the macro because i can embed it within a macro that i currently have and it gets automatically triggered whenver the cell changes. so all i'm worried about is how to have the macro check if any of those cells is an error and then change the background color of B15 to red.
May 24 '10 #1

✓ answered by patjones

Try pasting this into a VBA window and compiling. You can run it as a macro.

Expand|Select|Wrap|Line Numbers
  1. Public Sub ChangeColor()
  2.  
  3. If IsError(Sheet1.Cells(15, 13)) Or IsError(Sheet1.Cells(15, 15)) Or IsError(Sheet1.Cells(15, 17)) Or IsError(Sheet1.Cells(15, 19)) Then
  4.     Sheet1.Cells(15, 2).Interior.Color = RGB(255, 0, 0)
  5. Else
  6.     Sheet1.Cells(15, 2).Interior.Color = RGB(255, 255, 255)
  7. End If
  8.  
  9. End Sub

Pat

2 2020
patjones
931 Expert 512MB
Try pasting this into a VBA window and compiling. You can run it as a macro.

Expand|Select|Wrap|Line Numbers
  1. Public Sub ChangeColor()
  2.  
  3. If IsError(Sheet1.Cells(15, 13)) Or IsError(Sheet1.Cells(15, 15)) Or IsError(Sheet1.Cells(15, 17)) Or IsError(Sheet1.Cells(15, 19)) Then
  4.     Sheet1.Cells(15, 2).Interior.Color = RGB(255, 0, 0)
  5. Else
  6.     Sheet1.Cells(15, 2).Interior.Color = RGB(255, 255, 255)
  7. End If
  8.  
  9. End Sub

Pat
May 25 '10 #2
loudey
20
thanks Pat this works exactly like i wanted

highly appreciated
Loudey
May 25 '10 #3

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

Similar topics

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...
4
by: Bradley | last post by:
I have an A2000 database in which I have a continuous form with a tick box. There is also a text box with a conditional format that is based on the expression , if it's true then change the...
8
by: Dimitri Furman | last post by:
Given: Access 2002/2003 A subform in datasheet or continuous view, placed on a tab page (this last may or may not matter) Conditional formatting applied to some controls on the subform - format...
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...
2
by: Sara | last post by:
The problem: Conditional formatting bold, red when field Value < date() sets the field background to white - always - whether condition is met or not. I want the field unfilled and just red/bold...
5
by: Andrew Chanter | last post by:
Does anyone know a way you can use conditional formatting to create a banded style view as is commonly seen on the internet. (In othe words the first record appears on a gray background, the 2nd...
3
by: DS | last post by:
I have a Field that reads #Error, sometimes...I want to use conditional formatting to hide the field when it reads #Error...so in conditional formatting I put - when field equals "#Error" , but it...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
4
by: midlothian | last post by:
Hello, I have conditional formatting set up on a subform based on a calculated value in the underlying query. For instance, if Sales are >$1000, the query displays "Yes," otherwise it displays...
2
by: Filips Benoit | last post by:
Dear All, Access 2003 adp on SQL_server 2005 A continious form showing 1 month based on table 'CALENDAR_MONTH_GRID' and fill with a SP. Fields: Companyname, Day1, day2, etc. The value in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.