Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Userform Problem

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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,
    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. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thankyou
    This worked perfectly.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •