MasterVitez
New Member
- Joined
- Feb 18, 2019
- Messages
- 5
Hello there!
I'm working on an Excel table, which has multiple worksheets, and I always have to print only some of them. I wrote a simple cell reference to determine which sheets I have to print (atm. its value is: "EX_A1", "EX_B1").
I wrote a VBA macro which should handle the sheet selection and the printing. Printing is not a problem, the sheet selection which doesnt working for me. The name of the sheets I just wrote above is in the CTRL!C13 cell, and the (non-working) VBA code to select these worksheets is:
This gives me a "Run-time error '9': Subscript out of range" error. I tried numerous modifications for this VBA code to make it working, but after hours of trying it still doesnt working.
If I simply put the following code into working, the code works fine, but the sheet selection will always changing, and the sheet names will be found in the CTRL!C13 cell:
Please help me to solve this problem.
Thanks in advance!
I'm working on an Excel table, which has multiple worksheets, and I always have to print only some of them. I wrote a simple cell reference to determine which sheets I have to print (atm. its value is: "EX_A1", "EX_B1").
I wrote a VBA macro which should handle the sheet selection and the printing. Printing is not a problem, the sheet selection which doesnt working for me. The name of the sheets I just wrote above is in the CTRL!C13 cell, and the (non-working) VBA code to select these worksheets is:
Code:
ThisWorkbook.Sheets(Array(Worksheets("CTRL").Range("C13").Text)).Select
This gives me a "Run-time error '9': Subscript out of range" error. I tried numerous modifications for this VBA code to make it working, but after hours of trying it still doesnt working.
If I simply put the following code into working, the code works fine, but the sheet selection will always changing, and the sheet names will be found in the CTRL!C13 cell:
Code:
ThisWorkbook.Sheets(Array("EX_A1", "EX_B1").Select
Please help me to solve this problem.
Thanks in advance!