[Hi there,
I currently have a user form that can skip through records on my user form with two buttons < and >. (See attached picture). There is a textbox in between these buttons indicating the row number of record we are looking at. The code for these buttons is below. Is there anyway i could build somthing that allows the user to enter a number into this textbox, press return and then its skips to the relevant record???
[vba]
Private Sub btnNext_Click()
' Increment row number:
lCurrentRow = lCurrentRow + 1
' Show contents of new row in the form:
txtSurname.Text = Cells(lCurrentRow, 1).Value
txtForename.Text = Cells(lCurrentRow, 2).Value
ddlAssignee.Text = Cells(lCurrentRow, 3).Value
txtPersNum.Text = Cells(lCurrentRow, 4).Value
txtStartDate.Text = Cells(lCurrentRow, 5).Value
txtEndDate.Text = Cells(lCurrentRow, 6).Value
ddlDivision.Text = Cells(lCurrentRow, 7).Value
ddlLocation.Text = Cells(lCurrentRow, 8).Value
txtLineManager.Text = Cells(lCurrentRow, 9).Value
txtVCS.Text = Cells(lCurrentRow, 10).Value
ddlHealth.Text = Cells(lCurrentRow, 11).Value
txtRow.Text = lCurrentRow
End Sub
Private Sub btnPrev_Click()
' Show previous only if not already in first row:
If lCurrentRow > 1 Then
' Decrement row number:
lCurrentRow = lCurrentRow - 1
' Show contents of new row in the form:
txtSurname.Text = Cells(lCurrentRow, 1).Value
txtForename.Text = Cells(lCurrentRow, 2).Value
ddlAssignee.Text = Cells(lCurrentRow, 3).Value
txtPersNum.Text = Cells(lCurrentRow, 4).Value
txtStartDate.Text = Cells(lCurrentRow, 5).Value
txtEndDate.Text = Cells(lCurrentRow, 6).Value
ddlDivision.Text = Cells(lCurrentRow, 7).Value
ddlLocation.Text = Cells(lCurrentRow, 8).Value
txtLineManager.Text = Cells(lCurrentRow, 9).Value
txtVCS.Text = Cells(lCurrentRow, 10).Value
ddlHealth.Text = Cells(lCurrentRow, 11).Value
txtRow.Text = lCurrentRow
End If
End Sub
[/vba]
Many Thanks for any help