slimpickens
New Member
- Joined
- Feb 17, 2002
- Messages
- 35
I have used this code to get the next available number.
Private sub userform_initialize()
Dim maxval
maxval=WorksheetFunction.Max(Sheets("Sheet1").Range("A:A")) + 1
Userform1.textbox1.text=maxval
I also have a command button on my form which lets me add a record or exit the userform. My problem is that when I add another record my textbox is not recording the next available number. I am guessing that it has something to do with the fact that the form is not being initialized. Can anyone offer any assistance.
Carol
Private sub userform_initialize()
Dim maxval
maxval=WorksheetFunction.Max(Sheets("Sheet1").Range("A:A")) + 1
Userform1.textbox1.text=maxval
I also have a command button on my form which lets me add a record or exit the userform. My problem is that when I add another record my textbox is not recording the next available number. I am guessing that it has something to do with the fact that the form is not being initialized. Can anyone offer any assistance.
Carol