Code to drive a printer through an excel table Hi, I have a variable size excel
ID: 3560760 • Letter: C
Question
Code to drive a printer through an excel table
Hi,
I have a variable size excel table in cols B to H which starts in row 7 (row 6 is for the titles).
In col B I have the names of the sheets within the workbook.
In col H I have the number of copies of each sheet (given by row B that need printed. Any row in H with a number less than 1 should not have its corresponding sheet printed.
The print area is preset in all the worksheets (and should always be the same anyway).
The printer to be used is the default printer.
I am sturggling to do an IF type print code in order to achieve this.
Would anyone be able to help me please?
Thankyou
Explanation / Answer
%T^ry this:;
Sub PrintMacro()
Dim rngC As Range
With Worksheets("SheetName") 'Name of the sheet with the table
For Each rngC In .Range(.Range("B7"), .Cells(.Rows.Count, "B").End(xlUp))
If .Cells(rngC.Row, "H").Value >= 1 Then
Worksheets(rngC.Value).PrintOut copies:=.Cells(rngC.Row, "H").Value
End If
Next rngC
End With
End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.