Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default use of Case-Select, with on error

Morning all.
After month's of attempting to better understand error traps, I'm interested
in one last option.
The use of Case-Select with on error.
Because we're processing over 6000 files with the macros many of you have
helped us develop, we've found so far in our initial trials that there are a
variety of errors we see.
In order to catch as many of the errors as possible without interrupting our
work flow I've been thinking about using Case-select with groups of the
trappable error #'s as seen on the "trappable errors" list from the Excel
Help file.

My question here is- how do I set up the initial select statement?

My initial thoughts a

Select Case err.number

case 1 to 50
call MacroA

case 51 to 100
Call MacroB

....
......
...

case 1000 to 1500
Call MacroN

end select


Some further clarification on the use of the err.number in this instance
would be appreciated.
Thank you.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 236
Default use of Case-Select, with on error

This'll give you a listing of the available errors. Run it, take a look at
the descritpions and decide what ranges to group together in your case
statement.
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown


'/====================================/
Public Sub ErrorList()
'create list of all errors with descriptions from
' Active Cell down
Dim i As Long, iMax As Long, x As Long
Dim varAnswer As Variant

On Error GoTo err_Sub

iMax = 5000

varAnswer = _
MsgBox("The process will list errors and descriptions." _
& vbCr & vbCr & "Any errors with the description " _
& vbCr & "'Application-defined or " & _
"object-defined error' will not be included in the list." _
& vbCr & vbCr & _
"All cells below the Active cell will be erased." & _
vbCr & vbCr & "Continue?", _
vbCritical + vbYesNo + vbDefaultButton2, _
"Create Error Listing...")

If varAnswer = vbYes Then
On Error Resume Next
ActiveCell.Offset(x, 0).value = "Err.Number"
ActiveCell.Offset(x, 1).value = "Err.Description"

For i = 1 To iMax
Err.Clear
Err.Raise i
If Len(Err.Description) < 0 And _
Err.Description < _
"Application-defined or object-defined error" Then
x = x + 1
ActiveCell.Offset(x, 0).value = Err.Number
ActiveCell.Offset(x, 1).value = Err.Description
End If
Err.Clear
Next i
End If

On Error GoTo err_Sub
Err.Clear

Cells.EntireColumn.AutoFit
ActiveCell.Offset(1, 0).Activate
ActiveWindow.FreezePanes = False
ActiveWindow.FreezePanes = True
ActiveWindow.Zoom = 75

exit_Sub:
Exit Sub

err_Sub:
GoTo exit_Sub
End Sub
'/====================================/




"Steve" wrote:

Morning all.
After month's of attempting to better understand error traps, I'm interested
in one last option.
The use of Case-Select with on error.
Because we're processing over 6000 files with the macros many of you have
helped us develop, we've found so far in our initial trials that there are a
variety of errors we see.
In order to catch as many of the errors as possible without interrupting our
work flow I've been thinking about using Case-select with groups of the
trappable error #'s as seen on the "trappable errors" list from the Excel
Help file.

My question here is- how do I set up the initial select statement?

My initial thoughts a

Select Case err.number

case 1 to 50
call MacroA

case 51 to 100
Call MacroB

...
.....
..

case 1000 to 1500
Call MacroN

end select


Some further clarification on the use of the err.number in this instance
would be appreciated.
Thank you.

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
Case without Select Case error problem Ayo Excel Discussion (Misc queries) 2 May 16th 08 03:48 PM
Syntax Error ?. Execution does not enter the Select Case u473 Excel Programming 2 December 11th 07 04:56 PM
select case error ezil Excel Programming 0 July 14th 07 08:38 PM
Why Error Message "End Select without Select Case"? GoFigure[_13_] Excel Programming 5 December 9th 05 12:26 AM
Hopefully simple Select Case error Kobayashi[_15_] Excel Programming 3 October 3rd 03 07:46 PM


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