Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
HOW 2 COUNT ERRORS? | Excel Discussion (Misc queries) | |||
Count number of cells with data validation errors | Excel Programming | |||
count errors | Excel Worksheet Functions | |||
count errors | Excel Worksheet Functions | |||
COUNT function and errors within it - Need some expert knowledge | Excel Discussion (Misc queries) |