View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Umlas[_3_] Bob Umlas[_3_] is offline
external usenet poster
 
Posts: 320
Default Subscript Out Of Range Error Message

At least one of those sheets does not exist as spelled.
If you can't spot it, try this:
On error resume next
For i=1 to 12
ws=Sheets(Array("Rationale11", "Rationale12", "Rationale13",
"Rationale21", "Rationale22", "Rationale23", "Rationale31", "Rationale32",
"Rationale33", "Rationale41", "Rationale42", "Rationale43")(i+1)
err.clear
worksheets(Ws).activate
if err.number0 then msgbox ws & " doesn't exist"
Next

Bob Umlas

"Phil Hageman" wrote in message
...
When I open this workbook, I get an error message (Run-time error '9':

Subscript out of range.) on the following line of code:

For Each WS In ThisWorkbook.Sheets(Array("Rationale11", "Rationale12",

"Rationale13", "Rationale21", "Rationale22", "Rationale23", "Rationale31",
"Rationale32", "Rationale33", "Rationale41", "Rationale42", "Rationale43"))

Can someone suggest a fix?

Thanks, Phil