Qazi Sharifullah
New Member
- Joined
- May 11, 2017
- Messages
- 19
I HAVE DIFFERENT WORKSHEET, AND I WANT TO CREATE PRINT BUTTON IN EACH WORKSHEET. THANKS IN ADVANCE
Sub PrintTest()
Sheets("S1").PrintOut
End Sub
I HAVE DIFFERENT WORKSHEET, AND I WANT TO CREATE PRINT BUTTON IN EACH WORKSHEET. THANKS IN ADVANCE
Public Sub Add_Print_Button_To_All_Worksheets()
Dim ws As Worksheet
Dim printButton As Button
For Each ws In ThisWorkbook.Worksheets
Set printButton = ws.Buttons.Add(ws.Range("F2").Left, ws.Range("F2").Top, 80, 20)
printButton.Name = "Print sheet"
printButton.Caption = "Print " & ws.Name
printButton.OnAction = "Print_Sheet"
Next
End Sub
Public Sub Print_Sheet()
ActiveSheet.PrintOut Copies:=1
End Sub
sir here the report may vary according to the selection in the drop box ............. therefore i want to print only report not extra blank rows i.e. here i want to print it from A2 TO J14 ONLY. THANKSI HAVE THREE WORKSHEET S1, S2 AND S3, AND I WANT PRINT S1 ON BUTTON ONE, S2 ON BUTTON TWO, AND S3 ON BUTTON THREE. CAN ANY ONE HELP ME ABOUT THIS. THANK IN ADVANCE.
Public Sub Print_Sheet()
Dim lastRow As Long
With ActiveSheet
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("A2:J" & lastRow).PrintOut Copies:=1
End With
End Sub