Hi everyone,
First, I'd like to thank the collective community for their efforts in solving other people's excel issues as I've had many of the same problems. Secondly, I've looked all over the place and I've not been able to resolve my current issue with invoice numbering in an excel spreadsheet (macro enabled).
The issue: When I run my macro, my invoice numbers increase by two rather than one (eg. 1003 updates the new invoice as 1005, rather than 1004.) Here is my code used in Office 2007 (courtesy of many people on here, thank you!
)
Sub Run_All_Macros()
Save_New
Next_Invoice
End Sub
Sub Save_New()
Dim NewFN As String
ActiveSheet.Copy
NewFN = "" & Range("e7").Value & ".xlsm"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
Next_Invoice
End Sub
Sub Next_Invoice()
Range("e5").Value = Range("e5").Value + 1
Range("b10:b14, e7, e8, b17:e32, e33").ClearContents
End Sub
I've tried changing the value to "Value + 0", but that had obvious effects since the invoice numbers didn't change. I suspect the issue lies in the method the code is run, or more so in the order it is run, but to change the order would wipe my data before it has been saved. No? Anyhow, thank you all (in advance) for your amazing help!
cheers,
shawn
First, I'd like to thank the collective community for their efforts in solving other people's excel issues as I've had many of the same problems. Secondly, I've looked all over the place and I've not been able to resolve my current issue with invoice numbering in an excel spreadsheet (macro enabled).
The issue: When I run my macro, my invoice numbers increase by two rather than one (eg. 1003 updates the new invoice as 1005, rather than 1004.) Here is my code used in Office 2007 (courtesy of many people on here, thank you!

Sub Run_All_Macros()
Save_New
Next_Invoice
End Sub
Sub Save_New()
Dim NewFN As String
ActiveSheet.Copy
NewFN = "" & Range("e7").Value & ".xlsm"
ActiveWorkbook.SaveAs NewFN, FileFormat:=xlOpenXMLWorkbookMacroEnabled
ActiveWorkbook.Close
Next_Invoice
End Sub
Sub Next_Invoice()
Range("e5").Value = Range("e5").Value + 1
Range("b10:b14, e7, e8, b17:e32, e33").ClearContents
End Sub
I've tried changing the value to "Value + 0", but that had obvious effects since the invoice numbers didn't change. I suspect the issue lies in the method the code is run, or more so in the order it is run, but to change the order would wipe my data before it has been saved. No? Anyhow, thank you all (in advance) for your amazing help!
cheers,
shawn