Public Sub ComboBoxPopulate()
Sheets("MSS").Select
Dim counter As Integer
Dim cmbox_opt As String
Dim array_cmbox As ArrayList
Set array_cmbox = New ArrayList
Dim last_row As Integer
last_row = Range("B" & Rows.Count).End(xlUp).Row
For counter = 3 To last_row
cmbox_opt = Range("B" & counter).Value
If IsInArray(cmbox_opt, array_cmbox) Then
array_cmbox.Add cmbox_opt = False
Else
array_cmbox.Add cmbox_opt
End If
Next
End Sub
Public Function IsInArray(stringToBeFound As String, arr As Variant) As Boolean
Dim i
For i = LBound(arr) To UBound(arr)
If arr(i) = stringToBeFound Then
IsInArray = True
Exit Function
End If
Next i
IsInArray = False
End Function
Hi I'm trying to figure out why it's telling me that I have a type mismatch when I try to use the IsInArray function to determine if cmbox_opt is in the empty array. I used the VarType function to ensure that cmbox_opt is indeed a string and it is. So I don't understand why it wont accept it as a parameter inside the IsInArray function?