Excel打印自动增加

0

ALT+F11进入添加宏:

Sub autoIncrement()
    Dim index As Integer
    Dim total As Integer
    total = InputBox("打印总量") * 1
    index = InputBox("当前序号") * 1
    total = total + index - 1
    For i = index To total
        [D7] = Application.Text(i, "0000")
        ActiveSheet.PrintOut Copies:=1
    Next
End Sub

然后选择视图-宏-查看宏,选中autoIncrement,点击执行,输入打印数量就可以了。

C7是自增的Excel编号。