Forum Discussion
LilYawney
Apr 02, 2023Brass Contributor
VBA referencing a non-existent sheet
The VBA code in my Safety Inspection worksheet is referencing a worksheet named "Training". But that sheet doesn't exist in the workbook. I have already made sure that there are no hidden pages. I kn...
mtarler
Apr 02, 2023Silver Contributor
LilYawney You say "there are no hidden pages" but how did you check? There is a property/option for "VeryHidden" meaning on the workbook if you right click on the sheet tabs to 'unhide' it isn't there.
Since you are in VBA, did you check the project explorer (ctrl-R if it isn't open) as shown on the left in this image? Or Type in the Immediate window (ctrl-g) as shown in the image to check for the status (i.e. a 2 = VeryHidden
LilYawney
Apr 02, 2023Brass Contributor
I did do the right click on the sheet tabs to unhide all sheets; however, there weren't any extra sheets in the project explorer. I did try to check the status in the immediate window but I keep getting a popup message saying "runtime error 9: subscript out of range"
- HansVogelaarApr 02, 2023MVP
The workbook that you attached to your other recent discussion does not contain a worksheet Training, indeed. I'd remove the entire Module1 - the code in this module is not called in any other module.