I'm able to print worksheets using the following VBA:
Worksheets(Array("HOME", "Accounts", "Expenditure report", "Supporting schedules", "Payments")).Select
Application.Dialogs(xlDialogPrint).Show
I can generate the worksheets through using formulae and holding the string in cell B1, eg:
"HOME","Accounts","Expenditure report","Supporting schedules","Payments"
In the VBA I'm defining B1 as 'SheetsToPrint' and using that in the array rather than hardcoding it as above. Unfortunately, I can't get VBA which will compile. I've tried:
Code
1--------------------------------------------
Dim SheetsToPrint As Variant
SheetsToPrint = Range("B1").Select
Worksheets(Array(SheetsToPrint)).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
2---------------------------------------------
Dim SheetsToPrint As String
SheetsToPrint = Range("B1").Select
Worksheets(Array(SheetsToPrint)).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
3---------------------------------------------
Dim SheetsToPrint As Variant
SheetsToPrint = Range("B1").value
Worksheets(Array(SheetsToPrint)).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
4---------------------------------------------
Dim SheetsToPrint As String
SheetsToPrint = Range("B1").value
Worksheets(Array(SheetsToPrint)).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
5---------------------------------------------
Dim SheetsToPrint As Variant
SheetsToPrint = Range("B1").Value
Worksheets(Array("SheetsToPrint")).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
6---------------------------------------------
Dim SheetsToPrint As String
SheetsToPrint = Range("B1").Value
Worksheets(Array("SheetsToPrint")).Select '<<<COMPLIER ERRORS ON THIS
-----------------------------------------------
Display More
I'm using Excel 365 for Mac
Look forward to any suggestions
Thanks