Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How to use the Worksheet Change event to monitor if cells haveerrors?

Hi there

I have a sheet where some cells have (quite long) formulas in them.
Sometimes, if the cells that they refer to are empty, the formula
cells will have #VALUE! and #N/A errors in them. I could use something
like =IF(ISERROR(formula),"",formula) to show a blank cell if there's
an error but the problem is that some of the formulas are very long
and using this method will just make them much longer.

Is there any way that I can use the WorsheetChange event (or anything
else in VBA event-related) to constantly check cells to see if they
have errors or not and if they do, to just make the cell blank.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How to use the Worksheet Change event to monitor if cells haveerrors?

You may be able to use the worksheet_calculate event (since you're using
formulas). But as soon as you replace the formula that returns the error with a
"" (or clearing the contents), then the formula is gone.

Personally, I think your solution to use:
=if(iserror(yourformula),"",yourformula)
is what I'd use.

But an alternative that won't replace the error and won't change the formula is
to use format|conditional formatting (xl2003 menus).

Select the range to "fix" (say A1:B9):
with A1 the activecell
Format|conditional formatting
Formula is:
=iserror(a1)
and give it a format that hides the error (white font on white fill???).

The cell still holds the error -- so you'll have to watch out in other
calculations, but it'll look pretty.

wrote:

Hi there

I have a sheet where some cells have (quite long) formulas in them.
Sometimes, if the cells that they refer to are empty, the formula
cells will have #VALUE! and #N/A errors in them. I could use something
like =IF(ISERROR(formula),"",formula) to show a blank cell if there's
an error but the problem is that some of the formulas are very long
and using this method will just make them much longer.

Is there any way that I can use the WorsheetChange event (or anything
else in VBA event-related) to constantly check cells to see if they
have errors or not and if they do, to just make the cell blank.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default How to use the Worksheet Change event to monitor if cells haveerrors?

On Apr 26, 7:40 pm, Dave Peterson wrote:
You may be able to use the worksheet_calculate event (since you're using
formulas). But as soon as you replace the formula that returns the error with a
"" (or clearing the contents), then the formula is gone.

Personally, I think your solution to use:
=if(iserror(yourformula),"",yourformula)
is what I'd use.

But an alternative that won't replace the error and won't change the formula is
to use format|conditional formatting (xl2003 menus).

Select the range to "fix" (say A1:B9):
with A1 the activecell
Format|conditional formatting
Formula is:
=iserror(a1)
and give it a format that hides the error (white font on white fill???).

The cell still holds the error -- so you'll have to watch out in other
calculations, but it'll look pretty.

wrote:

Hi there


I have a sheet where some cells have (quite long) formulas in them.
Sometimes, if the cells that they refer to are empty, the formula
cells will have #VALUE! and #N/A errors in them. I could use something
like =IF(ISERROR(formula),"",formula) to show a blank cell if there's
an error but the problem is that some of the formulas are very long
and using this method will just make them much longer.


Is there any way that I can use the WorsheetChange event (or anything
else in VBA event-related) to constantly check cells to see if they
have errors or not and if they do, to just make the cell blank.


--

Dave Peterson


Hmmm, that actually works pretty well, thank you!
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
Worksheet Change Event - Colour infill cells dd Excel Programming 2 April 4th 07 08:08 PM
Event code to continuously monitor change Ybor Tony Excel Programming 3 October 20th 06 05:09 PM
Cell value change to trigger macro (worksheet change event?) Neil Goldwasser Excel Programming 4 January 10th 06 01:55 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 08:56 PM.

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

About Us

"It's about Microsoft Excel"