A Albert Chong Nov 29, 2003 #1 i tried to put the invoice number in my invvoice, but how to make it incease by itself when i print a new one?
i tried to put the invoice number in my invvoice, but how to make it incease by itself when i print a new one?
S Shailesh Shah Nov 29, 2003 #2 Hi, Try this, Put below code in thisworkbook's module. Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim MyAct Dim InvSht As Worksheet Dim InvNo As Range Set InvSht = Worksheets("Sheet1") 'Change to suite Set InvNo = InvSht.Range("F1") 'Change to suite If ActiveSheet.Name = InvSht.Name Then MyAct = MsgBox("Do you want to print Invoice with Invoice No. Auto increment?", vbYesNo, "Print Invoice") If MyAct = vbYes Then InvNo = InvNo + 1 End If End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/
Hi, Try this, Put below code in thisworkbook's module. Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim MyAct Dim InvSht As Worksheet Dim InvNo As Range Set InvSht = Worksheets("Sheet1") 'Change to suite Set InvNo = InvSht.Range("F1") 'Change to suite If ActiveSheet.Name = InvSht.Name Then MyAct = MsgBox("Do you want to print Invoice with Invoice No. Auto increment?", vbYesNo, "Print Invoice") If MyAct = vbYes Then InvNo = InvNo + 1 End If End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/