Reputation: 11
I'm trying to make a selection of multiple sheets one workbook based on run macros. At the end I have string containing sheets for selection, but my program prompt errors ...
Example:
SheetPrintPDF=Split(SheetPrintPDFTemp, ",")
Rem Debug show me that SheetPrintPDFTemp contains "Sheet1, Sheet17, Sheet24"
Wb1.Sheets(Array(SheetPrintPDF)).Select
Rem Program error "method class sheet error"
when I write ...
Wb1.Sheets(Array("Sheet1", "Sheet17", "Sheet24")).Select
Select works fine.
Upvotes: 1
Views: 3054
Reputation: 11
I solved by filling the values directly into the field into the FOR loop
Example. ArrayTemp(x) = SheetPrintPDFTemp
Upvotes: 0
Reputation: 3435
The problem is that you don't need to label the array as an array in your desired code because it already is one. Try:
Wb1.Sheets(SheetPrintPDF).Select
Upvotes: 1