PC Review


Reply
Thread Tools Rate Thread

Code to check errors in excel 2002

 
 
Redan
Guest
Posts: n/a
 
      24th Jan 2008
Hello,

Does anyone have a vba code that checks if all the formulas inside a
worksheet does not contain any errors such as #REF, etc ... ?

Thank you in advance !

 
Reply With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      24th Jan 2008
MyError = WorksheetFunction.IsError(Range("A1"))

"Redan" wrote:

> Hello,
>
> Does anyone have a vba code that checks if all the formulas inside a
> worksheet does not contain any errors such as #REF, etc ... ?
>
> Thank you in advance !
>

 
Reply With Quote
 
dbKemp
Guest
Posts: n/a
 
      24th Jan 2008
On Jan 24, 6:06 am, "Redan" <re...@gmail.com> wrote:
> Hello,
>
> Does anyone have a vba code that checks if all the formulas inside a
> worksheet does not contain any errors such as #REF, etc ... ?
>
> Thank you in advance !


Public Function WorksheetErrors(ByRef Target As Range) As Boolean
Dim rCell As Range
Dim vErrorArray As Variant
Dim iCounter As Integer

vErrorArray = Array("#N/A", "#DIV/0!", "#NAME?", "#NULL!", "#NUM!",
"#REF!", "#VALUE!")
Application.EnableEvents = False
For iCounter = 0 To UBound(vErrorArray)
With Target
Set rCell = .Find(vErrorArray(iCounter), LookIn:=xlValues,
lookat:=xlWhole)
If Not rCell Is Nothing Then
WorksheetErrors = True
Exit For
End If
End With
Next

Set rCell = Nothing
End Function
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      24th Jan 2008
This checks to see what the formulas evaluate to:

Option Explicit
Sub testme()

Dim TestRng As Range
Dim wks As Worksheet

Set wks = ActiveSheet
With wks

Set TestRng = Nothing
On Error Resume Next
Set TestRng = .Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
On Error GoTo 0

If TestRng Is Nothing Then
MsgBox "No errors in formulas!"
Else
MsgBox "You've got errors here: " & TestRng.Address(external:=True)
End If
End With

End Sub


Redan wrote:
>
> Hello,
>
> Does anyone have a vba code that checks if all the formulas inside a
> worksheet does not contain any errors such as #REF, etc ... ?
>
> Thank you in advance !










--

Dave Peterson
 
Reply With Quote
 
Redan
Guest
Posts: n/a
 
      25th Jan 2008
Thanks Dave!!!
"Dave Peterson" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> This checks to see what the formulas evaluate to:
>
> Option Explicit
> Sub testme()
>
> Dim TestRng As Range
> Dim wks As Worksheet
>
> Set wks = ActiveSheet
> With wks
>
> Set TestRng = Nothing
> On Error Resume Next
> Set TestRng = .Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
> On Error GoTo 0
>
> If TestRng Is Nothing Then
> MsgBox "No errors in formulas!"
> Else
> MsgBox "You've got errors here: " &
> TestRng.Address(external:=True)
> End If
> End With
>
> End Sub
>
>
> Redan wrote:
>>
>> Hello,
>>
>> Does anyone have a vba code that checks if all the formulas inside a
>> worksheet does not contain any errors such as #REF, etc ... ?
>>
>> Thank you in advance !

>
>
>
>
>
>
>
>
>
> --
>
> Dave Peterson


 
Reply With Quote
 
Redan
Guest
Posts: n/a
 
      28th Jan 2008
Hello Dave,

the code doesn't list #REF errors!
"Dave Peterson" <(E-Mail Removed)> a écrit dans le message de
news:(E-Mail Removed)...
> This checks to see what the formulas evaluate to:
>
> Option Explicit
> Sub testme()
>
> Dim TestRng As Range
> Dim wks As Worksheet
>
> Set wks = ActiveSheet
> With wks
>
> Set TestRng = Nothing
> On Error Resume Next
> Set TestRng = .Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
> On Error GoTo 0
>
> If TestRng Is Nothing Then
> MsgBox "No errors in formulas!"
> Else
> MsgBox "You've got errors here: " &
> TestRng.Address(external:=True)
> End If
> End With
>
> End Sub
>
>
> Redan wrote:
>>
>> Hello,
>>
>> Does anyone have a vba code that checks if all the formulas inside a
>> worksheet does not contain any errors such as #REF, etc ... ?
>>
>> Thank you in advance !

>
>
>
>
>
>
>
>
>
> --
>
> Dave Peterson


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Jan 2008
I started a test worksheet.

I put =A1 in C9

I deleted column A and ran the code and it showed the error.

Maybe you could be more specific.

Redan wrote:
>
> Hello Dave,
>
> the code doesn't list #REF errors!
> "Dave Peterson" <(E-Mail Removed)> a écrit dans le message de
> news:(E-Mail Removed)...
> > This checks to see what the formulas evaluate to:
> >
> > Option Explicit
> > Sub testme()
> >
> > Dim TestRng As Range
> > Dim wks As Worksheet
> >
> > Set wks = ActiveSheet
> > With wks
> >
> > Set TestRng = Nothing
> > On Error Resume Next
> > Set TestRng = .Cells.SpecialCells(xlCellTypeFormulas, xlErrors)
> > On Error GoTo 0
> >
> > If TestRng Is Nothing Then
> > MsgBox "No errors in formulas!"
> > Else
> > MsgBox "You've got errors here: " &
> > TestRng.Address(external:=True)
> > End If
> > End With
> >
> > End Sub
> >
> >
> > Redan wrote:
> >>
> >> Hello,
> >>
> >> Does anyone have a vba code that checks if all the formulas inside a
> >> worksheet does not contain any errors such as #REF, etc ... ?
> >>
> >> Thank you in advance !

> >
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> >
> > Dave Peterson


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2002 Errors Ty Microsoft Excel Programming 1 18th Aug 2009 09:58 PM
"compile error in hidden module: ThisWorkbook" for Excel 2002 - pls check this code ! Marie J-son Microsoft Excel Programming 7 18th Dec 2004 12:30 AM
spell check in Excel 2002 =?Utf-8?B?Q2FuJ3Qgc2VlIHBvdGVudGlhbCBlcnJvciBpbiBT Microsoft Excel Misc 2 18th Nov 2004 04:08 AM
Code errors in Excel 2002 =?Utf-8?B?TGEgRHVyYW5kZQ==?= Microsoft Excel Crashes 1 20th Sep 2004 01:00 PM
Excel 98 Workbook with Links In Excel 2002 gives errors Leslie Microsoft Excel Misc 3 20th Nov 2003 03:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:16 PM.