S
Shelly
I have been trying to get this sub to work, but with no luck. It takes "Index As String" to
represent either the sheet name or the Index, but it always dies with a "subscript out of range"
error when called by a loop such as:
For i = 2 To 4 Step 1
If Worksheets(i).Visible <> xlHidden Then
Reset_Sheets (i)
End If
Next
When the sub is called by itself as in:
Reset_Sheets ("System_2")
it works fine. I have checked the values passed and the are correct either when I pass a number or
the sheet name. I am really perplexed by this.
The problem sub is:
With Worksheets(Index) <-- subscript out of range error stops here
.Name = Index ' this returns the sheet name to the default
For Each c In .Range("C6:F12")
c.Value = 0
Next
For Each c In .Range("C15:F19")
c.Value = 0
Next
....blah, blah, blah...
.Visible = xlSheetHidden
End With
Thank you for any advice you can give me,
Shelly
represent either the sheet name or the Index, but it always dies with a "subscript out of range"
error when called by a loop such as:
For i = 2 To 4 Step 1
If Worksheets(i).Visible <> xlHidden Then
Reset_Sheets (i)
End If
Next
When the sub is called by itself as in:
Reset_Sheets ("System_2")
it works fine. I have checked the values passed and the are correct either when I pass a number or
the sheet name. I am really perplexed by this.
The problem sub is:
With Worksheets(Index) <-- subscript out of range error stops here
.Name = Index ' this returns the sheet name to the default
For Each c In .Range("C6:F12")
c.Value = 0
Next
For Each c In .Range("C15:F19")
c.Value = 0
Next
....blah, blah, blah...
.Visible = xlSheetHidden
End With
Thank you for any advice you can give me,
Shelly
