Forum Discussion
ClaudeV2240
Oct 06, 2022Copper Contributor
VBA Code Working
Hi guys, I got this code from YouTube Video and it keeps giving me an error (Run-time error '9': Subscript out of range) on line 66. I have: double checked the code - it seems fine I have inc...
- Oct 06, 2022
Does the error appear for i = 13?
Line 66 of the code refers to a worksheet named according to the value in ThisWorkbook.Sheets(sh.cells(2, i).value) which would be ThisWorkbook.Sheets("ATHLONE EXPRESS BLACK") for i = 13.
According to your screenshot there isn't a worksheet named "ATHLONE EXPRESS BLACK" which would explain the error message.
OliverScheurich
Oct 06, 2022Gold Contributor
Does the error appear for i = 13?
Line 66 of the code refers to a worksheet named according to the value in ThisWorkbook.Sheets(sh.cells(2, i).value) which would be ThisWorkbook.Sheets("ATHLONE EXPRESS BLACK") for i = 13.
According to your screenshot there isn't a worksheet named "ATHLONE EXPRESS BLACK" which would explain the error message.
- ClaudeV2240Oct 06, 2022Copper ContributorHi, I actually solved it. I have the other sheet names in my User Management Sheet already without creating the sheets. When I removed them I solved the problem. But thanks. Tried yours and it worked also.