Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / April 2008

Tip: Looking for answers? Try searching our database.

How to use the Worksheet Change event to monitor if cells have     errors?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fayyaadh@gmail.com - 26 Apr 2008 18:29 GMT
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 - 26 Apr 2008 18:40 GMT
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.

> Hi there
>
[quoted text clipped - 8 lines]
> 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.

Signature

Dave Peterson

Fayyaadh Ebrahim - 26 Apr 2008 18:50 GMT
> 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
[quoted text clipped - 35 lines]
>
> Dave Peterson

Hmmm, that actually works pretty well, thank you!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.