![]() |
Need some help with a macro for printing selected sheets
I am not sure what I am missing in this macro but instead of printing all of
the worksheets that have been grouped, this only prints the active worksheet in the group. Below is a portion of the code I am using: Sub Print_range() Dim Month As Variant Set listRange = ThisWorkbook.Worksheets("Misc").Range("print_list" ) Month = InputBox("Enter Month as 3 letter first letter Capital: ") Select Case Month Case "": Exit Sub Case "Jul": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("E:E").Select Selection.PrintOut Copies:=1 Case "Aug": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("F:F").Select Selection.PrintOut Copies:=1 Case "Sep": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("G:G").Select Selection.PrintOut Copies:=1 End Select End Sub Thanks for the help! -- Constance |
Need some help with a macro for printing selected sheets
Try replacing the below line with
<<Selection.PrintOut Copies:=1 Activewindow.SelectedSheets.PrintOut Copies:=1 OR try the below modified macro Sub Print_range() Dim Month As Variant Set listRange = ThisWorkbook.Worksheets("Misc").Range("print_list" ) Month = InputBox("Enter Month as 3 letter first letter Capital: ") Dim arrSheets As Variant, rngRange As Range arrSheets = Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn &Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology") Select Case Month Case "": Exit Sub Case "Jul" Set rngRange = Columns("E:E") Case "Aug": Set rngRange = Columns("F:F") Case "Sep": Set rngRange = Columns("G:G") End Select For intTEmp = 0 To UBound(arrSheets) Worksheets(CStr(arrSheets(intTEmp))).rngRange.Prin tOut Copies:=1 Next End Sub -- If this post helps click Yes --------------- Jacob Skaria "Constance" wrote: I am not sure what I am missing in this macro but instead of printing all of the worksheets that have been grouped, this only prints the active worksheet in the group. Below is a portion of the code I am using: Sub Print_range() Dim Month As Variant Set listRange = ThisWorkbook.Worksheets("Misc").Range("print_list" ) Month = InputBox("Enter Month as 3 letter first letter Capital: ") Select Case Month Case "": Exit Sub Case "Jul": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("E:E").Select Selection.PrintOut Copies:=1 Case "Aug": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("F:F").Select Selection.PrintOut Copies:=1 Case "Sep": Sheets(Array("Womens Heart", "Physical Med & Rehab", "Phys Med-ARU&SNF", _ "Northwood", "Womens Health Ctr", "Forest Park", "Gyn & Birthing", "Bariatric", _ "Regency", "55912", "Palo Alto", "Radiology")).Select Sheets("Womens Heart").Activate Columns("G:G").Select Selection.PrintOut Copies:=1 End Select End Sub Thanks for the help! -- Constance |
All times are GMT +1. The time now is 12:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com