PC Review


Reply
Thread Tools Rate Thread

How to count number of errors?

 
 
Faraz A. Qureshi
Guest
Posts: n/a
 
      30th Jul 2009
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 With Quote
 
 
 
 
Joel
Guest
Posts: n/a
 
      30th Jul 2009
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 With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      30th Jul 2009
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" <(E-Mail Removed)> wrote in
message news:843DB191-C49B-4279-BB6E-(E-Mail Removed)...
> 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 With Quote
 
Faraz A. Qureshi
Guest
Posts: n/a
 
      31st Jul 2009
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 With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      31st Jul 2009
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" <(E-Mail Removed)> wrote in
message news:09EC6DF9-BB45-443C-9629-(E-Mail Removed)...
> 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 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
Count number of cells with data validation errors Gareth Microsoft Excel Programming 3 28th Oct 2008 07:16 PM
Re: Count that will display the number for each record in the count increment. Sylvain Lafontaine Microsoft Access ADP SQL Server 0 12th Jul 2008 04:25 PM
Count rows and insert number to count them. =?Utf-8?B?TWV4?= Microsoft Excel Misc 6 23rd Aug 2006 02:29 AM
count each cell that have a number and take that number and count. =?Utf-8?B?Vmljaw==?= Microsoft Excel Misc 3 19th May 2006 01:51 AM
count number of spelling errors in records =?Utf-8?B?Rm9yZXN0RG9u?= Microsoft Access 3 3rd Dec 2004 05:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:29 PM.