Morning,

I have written the code below that works fine however I need to change the following and not sure it is possible:

1) When I open the user form I have to click 'cmdadd' to 'populate' the listbox, I need the listbox to be populated when opened


2)I have the search function working however I would like to be able to usE one search box to search all the columns in the database and return the relevant textboxes


3)Once the search has been performed I need an a function that can update any changes made to the text boxes and update the database


4)When a new entry has been made I need the listbox to move to the last row so what has been entered is visible


Option Explicit

Private Sub cmdadd_Click()
Dim wks As Worksheet
Dim AddNew As Range

Set wks = Sheet1
Set AddNew = wks.Range("B65356").End(xlUp).Offset(1, 0)



AddNew.Offset(0, 0).Value = 0

AddNew.Offset(0, 1).Value = txtbox1.Text
AddNew.Offset(0, 2).Value = txtbox2.Text
AddNew.Offset(0, 3).Value = txtbox3.Text
AddNew.Offset(0, 4).Value = txtbox4.Text
AddNew.Offset(0, 5).Value = txtbox5.Text
AddNew.Offset(0, 6).Value = txtbox6.Text
AddNew.Offset(0, 7).Value = txtbox7.Text
AddNew.Offset(0, 8).Value = txtbox8.Text
AddNew.Offset(0, 9).Value = txtbox9.Text

lstDisplay.ColumnCount = 10
lstDisplay.RowSource = "C1:K65356"



End Sub

Private Sub cmdclear_Click()

Dim txt

   For Each txt In Frame2.Controls
   If TypeOf txt Is MSForms.TextBox Then
       txt.Text = ""
       End If
       Next txt
       
        For Each txt In Frame2.Controls
   If TypeOf txt Is MSForms.ComboBox Then
       txt.Text = ""
       End If
       Next txt
       
End Sub

Private Sub cmdclose_Click()

Dim iExit As VbMsgBoxResult

iExit = MsgBox("Please confirm that you want to exit", vbQuestion + vbYesNo, "Exit")

If iExit = vbYes Then

Unload Me

End If

End Sub

Private Sub cmddelete_Click()
Dim i As Integer


For i = 1 To Range("C65356").End(xlUp).Row - 1
    If lstDisplay.Selected(i) Then
          Rows(i + 1).Select
        Selection.DELETE
    End If
Next i
     
        
End Sub

Private Sub cmdprint_Click()
Application.Dialogs(xlDialogPrinterSetup).Show
ThisWorkbook.Sheets("Sheet1").PrintOut copies:=1

End Sub

Private Sub cmdsearch_Click()
Dim isearch As Long, i As Long

isearch = Worksheets("Sheet1").Range("E1").CurrentRegion.Rows.Count

For i = 9 To isearch

If Trim(Sheet1.Cells(i, 5)) <> Trim(txtSearch.Text) And i = isearch Then
MsgBox ("No search results found!")
txtSearch.Text = ""
txtSearch.SetFocus
End If

If Trim(Sheet1.Cells(i, 5)) = Trim(txtSearch.Text) Then

txtbox1.Text = Sheet1.Cells(i, 3)
txtbox2.Text = Sheet1.Cells(i, 4)
txtbox3.Text = Sheet1.Cells(i, 5)
txtbox4.Text = Sheet1.Cells(i, 6)
txtbox5.Text = Sheet1.Cells(i, 7)
txtbox6.Text = Sheet1.Cells(i, 8)
txtbox7.Text = Sheet1.Cells(i, 9)
txtbox8.Text = Sheet1.Cells(i, 10)
txtbox9.Text = Sheet1.Cells(i, 11)

Exit For

End If

Next i



End Sub

Thank you for your help