Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Code to check errors in excel 2002

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 !

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Code to check errors in excel 2002

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 !

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 58
Default Code to check errors in excel 2002

On Jan 24, 6:06 am, "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 !


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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Code to check errors in excel 2002

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 he " & 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
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Code to check errors in excel 2002

Thanks Dave!!!
"Dave Peterson" a écrit dans le message de
...
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 he " &
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Code to check errors in excel 2002

Hello Dave,

the code doesn't list #REF errors!
"Dave Peterson" a écrit dans le message de
...
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 he " &
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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Code to check errors in excel 2002

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" a écrit dans le message de
...
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 he " &
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
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
Unhiding Check Boxes in Excel 2002 MWL Excel Discussion (Misc queries) 1 February 13th 09 01:31 PM
I am getting runtime errors in exel 2002, using old excel 97 temp EdD Excel Discussion (Misc queries) 0 February 10th 06 04:16 PM
Protection of check boxes in excel 2002 Newbeetle Excel Discussion (Misc queries) 2 March 14th 05 12:59 PM
Check mark boxes in Excel 2002 Dan E[_2_] Excel Programming 0 July 8th 03 03:41 PM


All times are GMT +1. The time now is 09:17 AM.

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"