Hi,
I am new to the forum and to VBA, but am attempting to create a User Form for data entry.

I have followed instructions I found on this website: http://msdn.microsoft.com/en-us/libr...ffice.11).aspx, with some success, but am having trouble calling the data to the form and using the "Next" and "Previous" buttons now that I have added the "Last" button code.

My data is in a different location on the sheet (starts in row 55, column AE) than the example used in the link above, but I have tried following the example exactly and get the same error.

I believe the problem must be related to two snippets of code below:

If IsNumeric(RowNumber.Text) Then
    r = CLng(RowNumber.Text)

If r > 54 And r <= LastRow Then
In context, the code below does not appear to work (that is, I cannot press on the "Previous" button which the code is attached to and have it grab the data for the previous record - the button does not respond at all):

Private Sub CommandButton2_Click()

Dim r As Long

If IsNumeric(RowNumber.Text) Then
    r = CLng(RowNumber.Text)
    
    r = r - 1
    If r > 54 And r <= LastRow Then
        RowNumber.Text = FormatNumber(r, 0)
        
    End If
    
End If
End Sub

Here is the code that I am using for the LastRow variable:

Private Function FindLastRow()

Dim r As Long

r = 55
Do While r < 65536 And Len(Cells(r, 31).Text) > 0
    r = r + 1
    
Loop

FindLastRow = r

End Function

Private Sub UserForm_Initialize()

GetData
LastRow = FindLastRow

End Sub

Private Sub CommandButton1_Click()

RowNumber.Text = "55"

End Sub
Any help would be appreciated! If I have left out any info that would be important to solve this question please let me know.

Thanks.