title: Add new name from user form if not in list. Excel VBA
body: <p>Hi I am relatively new to VBA but have managed to adapt some code and write a bit myself.</p>
  
  <p>I now however have a problem. I have the below code that I found and adapted. I present a user form and the user inputs a name and other information.</p>
  
  <p>The code searches the list of names and adds the other information alongside the name. Over writing what is already there. If I have a new user I have to add the name at the bottom and all continues to work well. </p>
  
  <p>I was wondering if anyone here could see in the code where I need to add some lines so if the code dose not find the name in the list then if addes it at the bottom please?</p>
  
  <pre><code>Private Sub txtName_AfterUpdate()
    Dim intMyVal As String
    Dim lngLastRow As Long
    Dim strRowNoList As String
  
   intMyVal = txtName.Value 'Value to search for, change as required.
      lngLastRow = Cells(Rows.Count, "AA").End(xlUp).Row 'Search Column AA, change as required.
  
      For Each cell In Range("AA4:AA" &amp; lngLastRow) 'Starting cell is AA4, change as required.
  
        If cell.Value = intMyVal Then
  
          If strRowNoList = "" Then
               strRowNoList = strRowNoList &amp; cell.Row
            Else
             strRowNoList = strRowNoList &amp; ", " &amp; cell.Row      
          End If
  
        End If
  
      Next cell
  
  End Sub 
  </code></pre>