I am trying to write VBA code that will print a print range that is presented in cell F3 on a "Reports" worksheet. The content of F3 will change depending on how many reports the user selects to print. For example, he could select one, two, three reports etc - up to twelve. The cell ranges of each report are named (e.g. Report1, Report2 etc) so that if the user selects to print Reports 1 and 2, the contents of cell F3 are "Report1,Report2".
If I replace WhatToPrint with "Report1,Report2" the print macro works. Can anyone help me to understand why it doesn't work when I leave WhatToPrint in?
Really appreciate your help with this!
Dim WhatToPrint As String
WhatToPrint = Sheets("Reports").Cells(3, 6).Value
ActiveCell.FormulaR1C1 = WhatToPrint
Sheets("Reports").PageSetup.PrintArea = WhatToPrint