excel vba for 调配车间

Sub SetA1()


'获取用户输入的序列号打印范围
mNumFrom = ThisWorkbook.Worksheets("Sheet1").Range("B1").Value
mNumTo = ThisWorkbook.Worksheets("Sheet1").Range("D1").Value




For r = mNumFrom To mNumTo Step 3


'将序列号填入对于位置
ThisWorkbook.Worksheets("Sheet1").Range("A2").Value = r
ThisWorkbook.Worksheets("Sheet1").Range("A3").Value = r + 1
ThisWorkbook.Worksheets("Sheet1").Range("A4").Value = r + 2


'设置打印区域
ActiveSheet.PageSetup.PrintArea = "$A$2:$E$5"


'执行打印
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
        IgnorePrintAreas:=False
        
'延时一会儿
Application.Wait (Now + TimeValue("0:00:07"))


Next


End Sub

猜你喜欢

转载自blog.csdn.net/liu_zhen_wei/article/details/49794395