![]() |
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 |
Subscript Out Of Range Error Message
Bob,
Thanks for your reply. I closed the workbook, reopened, and everything works okay. There must have been a corruption somewhere along the line on opening... Phil "Bob Umlas" wrote: 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 |
All times are GMT +1. The time now is 08:13 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com