I have a sub which will later be turned into a function. I've listed it below is fairly self explanatory.
OK, now that you all know I'm an idiot, can someone steer me as to which I'm getting the error message on? I know that there has to be at least one sheet in a workbook, and it errors on i=1. That leads me to believe that it's my array, which I stink at.
Any help will be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.
Code:
Sub CopyAllSheets()
Dim S() As String
Dim SH
For i = 1 To Excel.ActiveWorkbook.Sheets.Count
Sheets(i).Activate
'''Getting a subscript out of range error
[b][COLOR=blue]S(i) = Sheets(i).Name[/color][/b]
Next
Sheets(Array(S)).Copy
End Sub
OK, now that you all know I'm an idiot, can someone steer me as to which I'm getting the error message on? I know that there has to be at least one sheet in a workbook, and it errors on i=1. That leads me to believe that it's my array, which I stink at.
Any help will be greatly appreciated.
Ron Repp
If gray hair is a sign of wisdom, then I'm a genius.