View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Norvascom Norvascom is offline
external usenet poster
 
Posts: 21
Default macro to continue running if error

On Feb 28, 5:01*pm, OssieMac
wrote:
My apologies. An error in the code I posted. It will work better if the
Select and Call are included within the Case instead of outside of it. Also
noted Dave's comment re Filter

Sub UpdateAll()
Dim sh As Worksheet
* * For Each sh In Worksheets

* * * Select Case sh.Name

* * * * Case "1", "2", "3", "4", "5", _
* * * * * "6", "7", "10", "11", "12", _
* * * * * "21", "22", "23", "24", "25", _
* * * * * "26", "27", "28", "29", "30", _
* * * * * "31", "41", "42", "43", "44", _
* * * * * "45", "46", "47", "48", "49", _
* * * * * "50", "51", "52", "53", "54", _
* * * * * "55", "61"

* * * * * sh.Select

* * * * * Call macFilter

* * * End Select

* * Next sh
End Sub

--
Regards,

OssieMac



"OssieMac" wrote:
I am assuming that the numbers are the actual sheet names and not the sheet
index number. If my assumption is correct then try the code below and there
will be no error.


Using Select Case, even though there is only one case, multiple names can be
used separated by a comma and in effect they become Or operators.


The reason for the error in your code is that if the sheet does not exist,
you cannot use it in the array in the For Each statement.


Sub UpdateAll()
Dim sh As Worksheet
* * For Each sh In Worksheets


* * * Select Case sh.Name


* * * * Case "1", "2", "3", "4", "5", _
* * * * * "6", "7", "10", "11", "12", _
* * * * * "21", "22", "23", "24", "25", _
* * * * * "26", "27", "28", "29", "30", _
* * * * * "31", "41", "42", "43", "44", _
* * * * * "45", "46", "47", "48", "49", _
* * * * * "50", "51", "52", "53", "54", _
* * * * * "55", "61"


* * * End Select


* * * sh.Select


* * * Call Filter


* * Next sh
End Sub


--
Regards,


OssieMac- Hide quoted text -


- Show quoted text -



Thanks OssieMac