I'm trying to select the first 8 sheets of a workbook with 30 sheets, so that I can perform a search operation in all those 8 sheets.
Since the name of those 8 sheets could change, I tryed the following code:
Dim MYARRAY(8) As String
MYARRAY(1) = Sheets(1).Name
MYARRAY(2) = Sheets(2).Name
MYARRAY(3) = Sheets(3).Name
MYARRAY(4) = Sheets(4).Name
MYARRAY(5) = Sheets(5).Name
MYARRAY(6) = Sheets(6).Name
MYARRAY(7) = Sheets(7).Name
MYARRAY(8) = Sheets(8).Name
Sheets(MYARRAY).Select
The problem is that when I get to the last statement (Sheets(myarray).Select), I get error 9, "Subscript out of range".
Can somebody , please help? I'm going nuts!
Bookmarks