可使用现成的这款,勾选仅递增打印。
这个要用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