![]() |
Is it possible to print a named range of data excel
Hi,
Is it possible to print a named range of data excel (the data is in a hidden sheet) My named ranges are "Filtered_Data" which is in the "Working" sheet and "Data_Table" which is in a hidden sheet called "Data", depending on what a listbox row source is I want to print one or these ranges to a default printer. My code is below: Private Sub cmd_print_Click() Dim Response As VbMsgBoxResult If ListBox2.RowSource = "Filtered_Data" Then 'code here to print "Filtered_Data" range Else Response = MsgBox("No data has been filtered, do you want to print all data?", vbQuestion + vbYesNo) If Response = vbNo Then Exit Sub 'code here to print "Data_Table" range MsgBox "All data has been sent to the printer.", vbInformation End If End Sub Any help would be greatly appreciated! Rachel |
Is it possible to print a named range of data excel
Private Sub cmd_print_Click()
Dim Response As VbMsgBoxResult If ListBox2.RowSource = "Filtered_Data" Then 'code here to print "Filtered_Data" range Range("Filtered_Data").PrintOut Copies:=1, Collate:=True Else Response = MsgBox("No data has been filtered, do you want to print all data?", vbQuestion + vbYesNo) If Response = vbNo Then Exit Sub 'code here to print "Data_Table" range Sheets("Data").Visible = True Range("Data_Table").PrintOut Copies:=1, Collate:=True Sheets("Data").Visible = False MsgBox "All data has been sent to the printer.", vbInformation End If End Sub Regards, Stefi |
All times are GMT +1. The time now is 12:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com