I am trying to set up a subroutine that protects and hides worksheets labeled as "restricted" and only protect worksheets labeled as "read only", as specified by the user in certain cells (see the image attached where the user would specify the status for each sheet). The code seems to work without a problem, only for the restricted portion of the sheets. However, as soon as I add the condition to check for the read only sheets, I get the subscript out of range error for the line marked by **, but the weird part is that its for the fourth element of the array always, so not sure why the first 3 work fine, or why adding the second condition stops it from working. If the "Case Read Only" and condition lines are taken out, it works fine. Maybe I am missing something obvious, I am fairly new to VBA as you can see by what is likely my inefficient code. Any help is very appreciated!
User table for selecting restricted and read only sheets
Private Sub Test()
Dim NumberOfSheets As Integer 'Variable for counting the sheets in model
NumberOfSheets = Application.Sheets.Count - 2 'Number of Sheets ignores Master Cmd sheet, and array starts at 0 so 2 is subtracted
Dim iCounter As Integer 'Counter for looping through the array
ReDim CheckWorksheets(NumberOfSheets) As String 'Restricted worksheet name variable declaration
Worksheets("Master Cmd").Activate 'Activate Master Cmd
Range("C7").Activate 'Activate first cell with sheet name
For iCounter = 0 To NumberOfSheets 'Loop to cycle through worksheet names
CheckWorksheets(iCounter) = ActiveCell.Offset(iCounter, 0) 'Setting array variable equal to worksheet name
Next iCounter
For iCounter = 0 To NumberOfSheets 'Loop to change restricted worksheets status to very hidden
Select Case ActiveCell.Offset(iCounter, 2)
Case "Restricted"
Worksheets(CheckWorksheets(iCounter)).Protect password:=AdminPassword 'Protecting sheets
Worksheets(CheckWorksheets(iCounter)).Visible = xlSheetVeryHidden 'Condition to see if status is restricted in Master Cmd sheet
Case "Read Only"
**Worksheets(CheckWorksheets(iCounter)).Protect password:=AdminPassword**
End Select
Next iCounter
End Sub

Debug.Print CheckWorksheets(iCounter)- is it what you expect?CheckWorksheetsarray, and theWorksheetsarray. The indexiCountermay be out of bounds for the first, and the name/string returned fromCheckWorksheetsmay be out of bounds for the second. You'll have to check both to see which is causing the error.