![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 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 |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
|
Quote:
rownumber = [A65536].End(xlUp).Row Assuming data is in Column A _________________ Kind Regards, Ivan F Moala http://<font color="green"><a href="...r Construction [ This Message was edited by: Ivan F Moala on 2002-04-11 04:04 ] |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Apr 2002
Location: NSW. Australia
Posts: 64
|
Thankyou
This worked perfectly. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|