如何设置EXCEL打印编号递增,如编号为LY0001打印时编号自动变为LY0002,以此类推,求解答,谢谢!

2024-12-25 07:06:56
推荐回答(2个)
回答1:

可使用现成的这款,勾选仅递增打印。

回答2:

这个要用vba实现,假设编号在第一个工作表的A1单元格,在thisworkbook代码窗口中输入以下代码:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim curentNum As Integer
curentNum = Right(Worksheets(1).Cells(1, 1), 4)
curentNum = curentNum + 1
Worksheets(1).Cells(1, 1) = "LY" + Format(curentNum, "0000")
ThisWorkbook.Save
End Sub