Userform Problem

Phil C

Board Regular
Joined
Apr 10, 2002
Messages
64
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
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
On 2002-04-11 03:01, Phil C wrote:

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

Try
rownumber = [A65536].End(xlUp).Row

Assuming data is in Column A


_________________
Kind Regards,<font size=+2><font color="red"> I<font color="blue">van<font color="red"> F M</font color="blue">oala</font></font></font>
<font color="green">[url]http://www.gwds.co.nz/ - Under Construction[/url]
This message was edited by Ivan F Moala on 2002-04-11 04:04
 
Upvote 0

Forum statistics

Threads
1,214,559
Messages
6,120,203
Members
448,951
Latest member
jennlynn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top