title: Populate userform with records from current row
body: <p>I have a userform with several textboxes, radio buttons, dropdowns, etc. When a user creates a new entry, the data is saved on the Data sheet, with one record occupying one row. Now I want to be able to click an "edit" button in column A which allows to load the userform preloaded with the data from this row.</p>
  
  <p>The issue is that when the form is loaded, the initialization macro resets all form fields to "", and I havent figured out how to tell VBA to load the calling row's data.</p>
  
  <p>Any suggestions on how to go about this?</p>
  
  <hr>
  
  <p>Here the code I have so far:
  call the userform when the NEW ENTRY button is clicked</p>
  
  <pre><code>Sub call_userform()
  
  Details.Show
  
  End Sub
  </code></pre>
  
  <p>when the userform is initialized:</p>
  
  <pre><code>Private Sub UserForm_Initialize()
  
  IC_logo.BackColor = RGB(81, 81, 73) ' ash grey
  
  'Empty all fields
  status.Value = "Open"
  serial = Evaluate("randbetween(10000,30000)")
  priority.Value = ""
  created_on.Value = Format(Date, "dd/mm/yyyy")
  created_by.Value = ""
  department.Value = ""
  floor.Value = ""
  area.Value = ""
  subarea.Value = ""
  details.Value = ""
  fu_name.Value = ""
  fu_department = ""
  
  Me.status.RowSource = "lst_status"              'Fill Status
  Me.priority.RowSource = "lst_priority"          'Fill Priorities
  created_by = Sheets("Settings").Range("B24")    'Fill Created By with Logon Username
  department = Sheets("Settings").Range("B25")    'Fill Created By with Logon Department
  Me.floor.RowSource = "lst_floor"                'Fill Floor
  Me.area.RowSource = "lst_area"                  'Fill Area
  Me.subarea.RowSource = "lst_subarea"            'Fill Subarea
  
  'Set follow up to construction company as per default
  'fu_2.Value = True
  
  'Set Focus on NameTextBox
  priority.SetFocus
  
  End Sub
  </code></pre>
  
  <p>when the SAVE button is clicked</p>
  
  <pre><code>Private Sub btn_save_Click()
  Dim emptyRow As Long
  
  'Activate Data sheet
  Sheets("Data").Activate
  
  'Determine emptyRow
  emptyRow = WorksheetFunction.CountA(Range("B:B")) + 1
  
  'Transfer information
  Cells(emptyRow, 2).Value = serial.Value
  Cells(emptyRow, 4).Value = created_on.Value
  Cells(emptyRow, 5).Value = created_by.Value
  Cells(emptyRow, 6).Value = priority.Value
  Cells(emptyRow, 7).Value = floor.Value
  Cells(emptyRow, 8).Value = area.Value
  Cells(emptyRow, 9).Value = subarea.Value
  Cells(emptyRow, 10).Value = details.Value
  
  If fu_1.Value = True Then
      Cells(emptyRow, 11).Value = fu_1.Caption
  End If
  If fu_2.Value = True Then
      Cells(emptyRow, 11).Value = fu_2.Caption
  End If
  If fu_3.Value = True Then
      Cells(emptyRow, 11).Value = fu_3.Caption
  End If
  If fu_4.Value = True Then
      Cells(emptyRow, 11).Value = fu_4.Caption
  End If
  
  If fu_name.Value &gt; 0 Or fu_department.Value &gt; 0 Then
      Cells(emptyRow, 12).Value = fu_name.Value &amp; " " &amp; fu_department.Value
  End If
  
  Cells(emptyRow, 13).Value = status.Value
  
  End Sub
  </code></pre>
  
  <p>As mentioned, the problem now is how do I load the userform with the data of the current row? Would that still be via <code>details.show</code> ?</p>