Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 690
Default macro to continue running if error

Hi. You would have to add a little more logic to this, but here's an
additional general idea:

Select Case Val(sh.Name)

Case 1 To 7, 10 To 12, 21 To 31 'etc
'Do Something
Case Else
'Do Nothing
End Select

= = = = = = =
HTH :)
Dana DeLouis

On 2/28/2010 8:42 PM, Norvascom wrote:
On Feb 28, 5:01 pm,
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




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
Error Handling then continue running modo8 Excel Programming 3 March 11th 09 03:29 AM
Continue running macro until last line of data. Steve Excel Programming 1 November 24th 08 07:56 AM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Worksheet Functions 1 May 3rd 08 02:35 PM
I tried to get around the problem of the pivot table field settingdefaulting to Count instead of Sum by running a macro of change the settingfrom Count to Sum. However, when I tried to run the Macro, I got error messageof run time error 1004, unable Enda80 Excel Discussion (Misc queries) 1 May 3rd 08 10:52 AM
How to continue macro if there is an error value msdrolf Excel Programming 1 November 2nd 06 07:23 PM


All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"