I'll start by saying I don't have much experience with VBA and macros...
I have been trying to use a macro to automatically increment invoice numbers upon opening a file, which I found at a website (but apparently I'm not allowed to link it due to this forum's rules)
The Code is as follows:
Something is wrong though - when I open the file, the value in D2 does not automatically increment. When I run the routine via the Debugger, it increments, but not when I open the file. This may have something to do with the code being saved as a "module" rather than a Macro, but every time I try to save it as a Macro, I either get a compile error, or else it tells me, "This action will reset your project, proceed anyway?" (note, this happens because I am trying to delete "Sub Macro1()" at the beginning of the macro).![]()
Private Sub Workbook_Open() Range(“D2”).Value = Range(“D2”).Value + 1 End Sub
How can I set up a proper macro that will increment the number in cell D2 every time I open the file?
Any advice would be much appreciated.
Bookmarks