title: Referencing value from Excel Listbox item in .Match function in VBA
body: <p>I am hoping to use the string value of a selected Listbox item in a .Match function within VBA - I need the the value '1' to be entered into the row where the value of the selection matches a value in column "A:A", on a specific column.</p>
  
  <p>What I thought I would be able to do is to use a .value argument for the selected ListBox item, however this seems to either error out or give me a Boolean response, which isn't what I am after (I am after the actual string value of the item).</p>
  
  <p>I have already looped through all items to set the Selected argument to True, and then I am looping through the list one by one to add '1' to the correct range.</p>
  
  <p>Here is the code I thought would work (but doesn't, it throws an error of "Run-time error '13': Type mismatch" which is presumably down to the .Value not being a String.</p>
  
  <pre><code>For x = 0 To Me.CreditsEmployeesListBox.ListCount - 1
  Me.CreditsEmployeesListBox.Selected(x) = True
  Next
  
  For i = 0 To Me.CreditsEmployeesListBox.ListCount - 1
  If Me.CreditsEmployeesListBox.Selected(i) = True Then
      employeeRow = WorksheetFunction.Match(Me.CreditsEmployeesListBox(i).Value, IndexSheet.Range("A:A"), 0)
      IndexSheet.Range(Cells(employeeRow, showCodeColumn).Address).Value = 1
  End If
  Next
  </code></pre>
  
  <p>It errors out on the 'employeeRow = ...' line. Here, I am essentially trying to ask it:</p>
  
  <pre><code>employeeRow = WorksheetFunction.Match(&lt;value of the currently referenced ListBox item&gt;,IndexSheet.Range("A:A"),0)
  </code></pre>
  
  <p>Is this possible with VBA or am I going about this the wrong way?</p>
  
  <p>Thanks
  Matt</p>