自动更新单据编号

Private Sub Workbook_BeforePrint(Cancel As Boolean)

Set a = Sheets("各种表格 ").[G2]

confirm = MsgBox("自动更新单据编号?", vbYesNoCancel)

If confirm = 2 Then Cancel = True: Exit Sub

If confirm = 6 Then

a.Value = "单据编号:JDGS2021" & WorksheetFunction.Text(Right(a.Value, 5) + 1, "00000")

End If

End Sub

放在thisworkbook中

(0)

相关推荐