Requirement:
The user is wanting to modify some VBA to print an area. Right now the user has a very quick print code but it alters the selection area because when the code runs you get moved to where the print area is.
Here is the users current code:
Sub S_Print() Range(Range("t1:v10"), Range("t1").End(xlDown)).Select Selection.PrintOut End Sub
How can the user modify it to just be something simple like Printout Range(":") and not have to change the print area or position on the worksheet?
https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/1197003-printout-range
Solution:
Sub PrnUnsold() ' Dim lr As Long lr = Cells(Rows.Count, "A").End(xlUp).Row With ActiveSheet .PageSetup.PrintArea = .Range("A1:F" & lr).Address End With ActiveSheet.PrintOut End Sub
Obtained from the OzGrid Help Forum.
Solution provided by Ediscot and Jolivanes.
See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets
See also:
How to create VBA code to increment number each time a copy is printed |
How to print range excluding blank rows with formulas |
How to print hidden sheets without viewing the sheet being printed |
How to print userform in orientation landscape |
Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.