I have created a userform that enters data into an excel spreadsheet. The form has an "Enter data" and a "Next Record" button both buttons work fine when the form is loaded. The problem is that when I exit the form and then reload it, it starts at the first cell and replaces the previous record. I need code that will select the first empty row. Here is some of the code for the form:
Option Explicit
Dim rownumber As Integer
rivate Sub cmdNext_Click()
rownumber = rownumber + 1
txtDate.SetFocus
End Sub
Private Sub UserForm_Initialize()
rownumber = 38
txtDate.SetFocus
End Sub
Using this code the data is entered from rownumber 38. What I need is code to replace the 38 with first empty row. Can anyone help with this?
thanks in advance
Option Explicit
Dim rownumber As Integer
rivate Sub cmdNext_Click()
rownumber = rownumber + 1
txtDate.SetFocus
End Sub
Private Sub UserForm_Initialize()
rownumber = 38
txtDate.SetFocus
End Sub
Using this code the data is entered from rownumber 38. What I need is code to replace the 38 with first empty row. Can anyone help with this?
thanks in advance