Hi,
Not sure if anyone can help, is it possible to print pages based on a cell value with VBA.
So if cell A1 contained “0” then 0 pages/copy’s would be printed, if A1 then contained “4” four pages would print?
Hi,
Not sure if anyone can help, is it possible to print pages based on a cell value with VBA.
So if cell A1 contained “0” then 0 pages/copy’s would be printed, if A1 then contained “4” four pages would print?
.
This works with the "activesheet" .. which can be any sheet you want. Cell "A1" of that sheet must have the number of times you want
the printer to print.
![]()
Option Explicit Sub PrntXTimes() ActiveSheet.PrintOut , Copies:=Sheet1.Range("A1").Value End Sub
Here is another method that allows the user more flexibility :
![]()
Sub PrntPrview() Application.CommandBars.ExecuteMso ("PrintPreviewAndPrint") End Sub
Hi Thanks for your help,
This is what I have, so the copies is cells O4 - O9, they all have different page ranged.
The print will be exercuted from sheet1, the print range is in sheet 2, the copies value is in sheet1. I have no idea why this isn't working, are you able to assist?
When running these I get runtime error 1004 Method 'range of object' '_worksheet' failed
![]()
Sub PrintPLTLABLE1() Range("A1:B11").PrintOut , Copies:=Sheet1.Range("04").Value End Sub Sub PrintPLTLABLE2() Range("A12:B22").PrintOut , Copies:=Sheet1.Range("05").Value End Sub Sub PrintPLTLABLE3() Range("A23:B33").PrintOut , Copies:=Sheet1.Range("06").Value End Sub Sub PrintPLTLABLE4() Range("A34:B44").PrintOut , Copies:=Sheet1.Range("07").Value End Sub Sub PrintPLTLABLE5() Range("A45:B55").PrintOut , Copies:=Sheet1.Range("08").Value End Sub Sub PrintPLTLABLE6() Range("A56:B66").PrintOut , Copies:=Sheet1.Range("09").Value End Sub
.
![]()
Sub PrintPLTLABLE1() Dim numrow As Long Dim i As Long Dim runmacro runmacro = Application.InputBox("How many print copies?", "Enter a number", , , , , , 1) If IsNumeric(numrow) Then For i = 1 To runmacro Range("A1:B11").PrintOut Next i End If End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks