View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Stefi Stefi is offline
external usenet poster
 
Posts: 2,646
Default 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