title: vba replace msgbox with userform
body: <p>i am trying to replace a msgbox with a userform, but when i show the userform it has no data in the textbox like it had in the msgbox, do i need to add some code to the textbox? here is what i have done</p>
  
  <pre><code>Sub unknown()
      Dim iListCount As Integer
      Dim iCtr As Integer
  
  
  
      ' Turn off screen updating to speed up macro.
      Application.ScreenUpdating = False
  
      ' Get count of records to search through (list that will be deleted).
      iListCount = Sheets("sheet2").Cells(Rows.Count, "A").End(xlUp).Row
  
      ' Loop through the "master" list.
      For Each x In Sheets("Sheet1").Range("A1:A" &amp; Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row)
      ' Loop through all records in the second list.
          For iCtr = iListCount To 1 Step -1
              ' Do comparison of next record.
              ' To specify a different column, change 1 to the column number.
              If x.Value = Sheets("Sheet2").Cells(iCtr, 1).Value Then
                  ' If match is true then delete row.
                  Sheets("Sheet2").Cells(iCtr, 1).EntireRow.Delete
              End If
          Next iCtr
      Next
      Application.ScreenUpdating = True
      If Application.WorksheetFunction.CountA(Range("A:A")) = 0 Then
          Exit Sub
      End If
      For Each r In Intersect(Range("A:A"), ActiveSheet.UsedRange)
          If r.Value &gt; "" Then
              msg = msg &amp; vbCrLf &amp; r.Value
          End If
      Next r
      ' this msgbox works ok
      'MsgBox msg, vbOKOnly, "Unknown servers"
  
      frmunknownservers.Show
      Textunknownservers.Text = msg
  
  End Sub
  </code></pre>