![]() |
Error Message
Me and someone else at work use a few macros
successfully. Another person always gets an error message when running one of the macros : "Run time error '9': Subscript out of range". When you hit debug it is at a point in the code where there is a do while loop : Do While Workbooks("Roster For Macro").Sheets ("Roster").Cells(k, i) < "" Would there be a reason why these macros (which all employ a similar do while loop) do not work on this one person's computer? We thought that maybe it was due to memory but when the person signed on on another computer the same thing happened so we thought it must be the personal set up. Thank you. |
Error Message
Subscript out of range indicates one of the following errors:
1. The Workbook name has been changed from Roster For Macro which woul give an out of range in the Workbooks collection. 2. The Sheet name has been changed from Roster which would give an ou of range in the Sheets collection. 3. Either k or i is outside of the range for rows/colums which woul give an error on the cells array. (k must be between 1 and 65536 and must be between 1 and 256.) For the first two issues, just verify the names. For the third, ad these lines before and inside the loop and check the result: Debug.Print "k: " & k & " i: " & i Do While Workbooks("Roster For Macro").Sheets("Roster").Cells(k, i) < "" Debug.Print "k: " & k & " i: " & i -- Message posted from http://www.ExcelForum.com |
Error Message
The subscript out of range only happens for one person not
the other two. The paths and spreadsheet names work for the other two people and work for this one person so I do not think it has anything to do with that. This one person gets the message when there is a do while loop. Thank you. -----Original Message----- Subscript out of range indicates one of the following errors: 1. The Workbook name has been changed from Roster For Macro which would give an out of range in the Workbooks collection. 2. The Sheet name has been changed from Roster which would give an out of range in the Sheets collection. 3. Either k or i is outside of the range for rows/colums which would give an error on the cells array. (k must be between 1 and 65536 and i must be between 1 and 256.) For the first two issues, just verify the names. For the third, add these lines before and inside the loop and check the result: Debug.Print "k: " & k & " i: " & i Do While Workbooks("Roster For Macro").Sheets ("Roster").Cells(k, i) < "" Debug.Print "k: " & k & " i: " & i K --- Message posted from http://www.ExcelForum.com/ . |
All times are GMT +1. The time now is 01:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com