[英]How can I create a VBA code to print our multiple copies of the same sheet?
I have a button in excel and I want it to print an X amount of copies. 我在excel中有一个按钮,希望它打印X份。 Like Say 10 so items come into stock. 就像说10一样,物品也要入库。 I want to print 10 copies. 我想打印10份。 I have formula that looks up the item info. 我有查找项目信息的公式。 I just want a code that Prints so many times for the "quantity" that I will fill in. 我只想要一个可打印多次的代码,以填写“数量”。
ActiveWindow.SelectedSheets.PrintOut Copies:=Range("A1").Value
Essentially.. 实质上..
Sub PrintXCopies()
ActiveSheet.PrintOut , , Range("A1").Value
End Sub
where the number of copies to print is in cell A1. 其中要打印的份数在单元格A1中。 You should add error-handling in case this is not a number, or a sensible number. 如果这不是数字或有意义的数字,则应添加错误处理。 Something like: 就像是:
Sub PrintXCopies()
If IsNumeric(Range("A1").Value) Then
If Range("A1").Value >= 1 And Range("A1").Value < 10 Then
ActiveSheet.PrintOut , , Range("A1").Value
End If
End If
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.