I have created a combo box that picks up data from a column in an excel spread-sheet. I then want my code to populate various other labels and text boxes in my userform using the value in the combo box.

This is (a cut-down version of) the code that I am using.

Code:
Private Sub UserForm_Activate()
For i = 2 To 5
ComboBox1.AddItem Sheets("Sheet3").Cells(i, 1)
Next i
End Sub

Private Sub Frequencies()
For i = 2 To 5
If ComboBox1 = Sheets("Sheet3").Cells(i, 1) Then
TextBox1 = Cells(i, 2)
End If
Next i
End Sub

Private Sub ComboBox1_AfterUpdate()
TextBox1 = ""
Call Frequencies
End Sub
The problem comes in with the fact that there are two types of data in column 1, strings and long numbers. The code works perfectly with strings and ignores the long numbers.

I’ve tried AddItem Cells(i, 1).Value if Cells(i, 1) is numeric, doesn’t work. I’ve tried putting the cell values in a variant array and then adding the array members to the combo-box, also doesn’t work.

I’ve tried using some extremely clunky coding involving the StrConv function but that was creating problems further down the track when the values in the user-form are entered into another sheet.

Does anyone have a simple solution to this problem? Thank you.