I'm creating a Purchase Order form that increments the numeric value in a cell by 1 each time the workbook is opened. The user immediately 'saves as' using this numbr as the filename. I did this using a MicrosoftExcelObject 'ThisWorkbook' with the following code:
Private Sub Workbook_Open()
Sheets("PO").Range("G4").Value = Sheets("PO").Range("G4").Value + 1
ThisWorkbook.Save
End Sub
This works well but unfortunately the number increments each time the workbook is opened for viewing. Is there a way to delete the above code using a macro after the initial opening of the file, allowing multiple openings without incrementing the number?
Thank you.
Private Sub Workbook_Open()
Sheets("PO").Range("G4").Value = Sheets("PO").Range("G4").Value + 1
ThisWorkbook.Save
End Sub
This works well but unfortunately the number increments each time the workbook is opened for viewing. Is there a way to delete the above code using a macro after the initial opening of the file, allowing multiple openings without incrementing the number?
Thank you.