Hello All,
Currently in excel 2016 for PC, I am running this print macro. Cells C55:C75 have unique names and in order to run the macro, I single click C55 (or whatever unique name that I want to print) and hit control b. This will print a unique sheet for that individual as there are some lookups tied to that name. The printer that I am using is capable of duplex or double sided printing and I was wondering how I could combine or add onto this print macro so that it prints double sided. For example, if you look at the macro I provided, the print range is A1:BK51, instead of cramming everything onto one side, I was wondering how I could have it print A1:AE51 on one side and then AG1:BK51 on the other side WHILE using the print macro, click unique name and hit contol b, to print the unique sheet double sided. Any help would be appreciated. Thanks.
Sub PrintSelectedNames()
'
' PrintSelectedNames Macro prints all selected athletes.
'
On Error GoTo ErrorHandler:
Dim cell As Object
For Each cell In Selection ' each selected item
'Dim i As Integer
'i = 1
' loop through weeks
'Do While SheetExists("Week" & i & "-" & (i + 1))
' grab value from roster
Range("A2").Value = cell.Value
' print it
Range("A1:BK51").PrintOut Copies:=1, Preview:=False
'i = i + 2
'Loop
Next cell
Exit Sub
ErrorHandler:
MsgBox "Something wrong happened:" & Err.Description
End Sub
Function SheetExists(SheetName As String) As Boolean
' returns TRUE if the sheet exists in the active workbook
SheetExists = False
On Error GoTo NoSuchSheet
If Len(Sheets(SheetName).Name) > 0 Then
SheetExists = True
Exit Function
End If
NoSuchSheet:
End Function
Currently in excel 2016 for PC, I am running this print macro. Cells C55:C75 have unique names and in order to run the macro, I single click C55 (or whatever unique name that I want to print) and hit control b. This will print a unique sheet for that individual as there are some lookups tied to that name. The printer that I am using is capable of duplex or double sided printing and I was wondering how I could combine or add onto this print macro so that it prints double sided. For example, if you look at the macro I provided, the print range is A1:BK51, instead of cramming everything onto one side, I was wondering how I could have it print A1:AE51 on one side and then AG1:BK51 on the other side WHILE using the print macro, click unique name and hit contol b, to print the unique sheet double sided. Any help would be appreciated. Thanks.
Sub PrintSelectedNames()
'
' PrintSelectedNames Macro prints all selected athletes.
'
On Error GoTo ErrorHandler:
Dim cell As Object
For Each cell In Selection ' each selected item
'Dim i As Integer
'i = 1
' loop through weeks
'Do While SheetExists("Week" & i & "-" & (i + 1))
' grab value from roster
Range("A2").Value = cell.Value
' print it
Range("A1:BK51").PrintOut Copies:=1, Preview:=False
'i = i + 2
'Loop
Next cell
Exit Sub
ErrorHandler:
MsgBox "Something wrong happened:" & Err.Description
End Sub
Function SheetExists(SheetName As String) As Boolean
' returns TRUE if the sheet exists in the active workbook
SheetExists = False
On Error GoTo NoSuchSheet
If Len(Sheets(SheetName).Name) > 0 Then
SheetExists = True
Exit Function
End If
NoSuchSheet:
End Function