Hello all
Its been a while since I have needed to post but this one has me stumped.
I have searched through archives over the past few days and cannot find help that exactly fits this problem.
I have created a template for a form that will be used many times a day. The idea is that each use of the form will generate a unique number (ie serial number) eg Y2001, Y2002 etc.
I have tried the following coding to change the serial number by one each time the form is opened (which is part of the problem);
Private Sub workbook_open()
Sheets("Permit to Work PG 1").Range("C2").Value = Sheets("Permit to Work PG 1").Range("C2").Value + 1
End Sub
However when I go to re-access the file for whatever reason, the serial number changes by 1.
It needs to remain fixed once used for that unique file.
The problem is that creating the form from the template and saving it as an .xls means the template does not save and therefore the serial number in the template does not increment for the next use.
The next part of the problem is once the form filled out it is to be saved with that unique number and the date in the filename to identify it.
Any suggestions will be greatly appreciated, thanks.
Ken
Its been a while since I have needed to post but this one has me stumped.
I have searched through archives over the past few days and cannot find help that exactly fits this problem.
I have created a template for a form that will be used many times a day. The idea is that each use of the form will generate a unique number (ie serial number) eg Y2001, Y2002 etc.
I have tried the following coding to change the serial number by one each time the form is opened (which is part of the problem);
Private Sub workbook_open()
Sheets("Permit to Work PG 1").Range("C2").Value = Sheets("Permit to Work PG 1").Range("C2").Value + 1
End Sub
However when I go to re-access the file for whatever reason, the serial number changes by 1.
It needs to remain fixed once used for that unique file.
The problem is that creating the form from the template and saving it as an .xls means the template does not save and therefore the serial number in the template does not increment for the next use.
The next part of the problem is once the form filled out it is to be saved with that unique number and the date in the filename to identify it.
Any suggestions will be greatly appreciated, thanks.
Ken