Today I encountered this error, but could not use any solution above, but I still managed to solve it myself.
My situation was that I had a list contained in column A. For each cell with a value, I saved the value in a variable, created a new sheet and named the sheet according to the value stored in the variable.
A little later in the code, I tried to select a newly created sheet using the code:
Sheets(ValueVariable).Select
I encountered a "Subcategory out of range" error, and I could not understand why. I used to use similar code with success. However, I solved it by exposing the variable as a string. Declaring a variable as a string does not seem to work for me.
So, if anyone else encounters this error and wants to try something, it might work for you:
Sheets(Cstr(ValueVariable)).Select
source share