Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default How to count number of errors?

In simple words what type of a code would be required for:
....
On Error
Counter=Counter+1;
Resume Next Or Goto 0
....

In the end:

Msgbox "Number of errors were " & Counter

--
Best Regards,

Faraz
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default How to count number of errors?

Sub test()

Dim a As Integer
Set c = Nothing
ErrorCount = 0
On Error GoTo 100
a = c

MsgBox "Number of errors were " & ErrorCount
Exit Sub

100:
ErrorCount = ErrorCount + 1
Resume Next


End Sub


"Faraz A. Qureshi" wrote:

In simple words what type of a code would be required for:
...
On Error
Counter=Counter+1;
Resume Next Or Goto 0
...

In the end:

Msgbox "Number of errors were " & Counter

--
Best Regards,

Faraz

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How to count number of errors?

Resume Next is probably what you are looking for, but there is a caution
that come with it. If your subsequent code depends on the correctly
calculated values that are erroring out above them, then you may end up
producing additional errors that would not normally occur had the previous
error not taken place which, of course, would give you a false count.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
In simple words what type of a code would be required for:
...
On Error
Counter=Counter+1;
Resume Next Or Goto 0
...

In the end:

Msgbox "Number of errors were " & Counter

--
Best Regards,

Faraz


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 211
Default How to count number of errors?

Would you please clarify with an example like finding how many of cells in
A1:A10 do not reflect the names of sheets present in a workbook?

Best Regards,

Faraz


"Joel" wrote:

Sub test()

Dim a As Integer
Set c = Nothing
ErrorCount = 0
On Error GoTo 100
a = c

MsgBox "Number of errors were " & ErrorCount
Exit Sub

100:
ErrorCount = ErrorCount + 1
Resume Next


End Sub


"Faraz A. Qureshi" wrote:

In simple words what type of a code would be required for:
...
On Error
Counter=Counter+1;
Resume Next Or Goto 0
...

In the end:

Msgbox "Number of errors were " & Counter

--
Best Regards,

Faraz

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default How to count number of errors?

I'm getting the feeling your use of the phrase "In simple words" in your
first posting was, perhaps, too simple a statement. VB's On Error statement
is used for responding to errors generated by your code, not errors on your
worksheet. I think it might be a good idea if you explain in some detail
exactly what your worksheet's set up is and what you are trying to do with
it.

--
Rick (MVP - Excel)


"Faraz A. Qureshi" wrote in
message ...
Would you please clarify with an example like finding how many of cells in
A1:A10 do not reflect the names of sheets present in a workbook?

Best Regards,

Faraz


"Joel" wrote:

Sub test()

Dim a As Integer
Set c = Nothing
ErrorCount = 0
On Error GoTo 100
a = c

MsgBox "Number of errors were " & ErrorCount
Exit Sub

100:
ErrorCount = ErrorCount + 1
Resume Next


End Sub


"Faraz A. Qureshi" wrote:

In simple words what type of a code would be required for:
...
On Error
Counter=Counter+1;
Resume Next Or Goto 0
...

In the end:

Msgbox "Number of errors were " & Counter

--
Best Regards,

Faraz


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
HOW 2 COUNT ERRORS? FARAZ QURESHI Excel Discussion (Misc queries) 3 November 4th 08 01:28 PM
Count number of cells with data validation errors Gareth[_2_] Excel Programming 3 October 28th 08 07:16 PM
count errors Bruce Excel Worksheet Functions 1 December 14th 06 06:21 AM
count errors stef Excel Worksheet Functions 1 October 12th 06 03:44 AM
COUNT function and errors within it - Need some expert knowledge stu eade Excel Discussion (Misc queries) 2 February 1st 05 01:07 AM


All times are GMT +1. The time now is 07:24 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"