I have a string that looks like "apples//apples//oranges//" I'm getting an error "subscript out of range" when I try to remove duplicates.
I want my end result to look like "apples//oranges//"
Dim duplicateArray() As String
Dim programsArray() As String
duplicateArray() = Split(Sheets("Sheet1").Cells(1, 12).Value, "//")
For j = 0 To UBound(duplicateArray)
If UBound(Filter(programsArray, duplicateArray(j))) > -1 Then
Else
programsArray(UBound(programsArray()) + 1) = duplicateArray(j)
End If
Next j
programElement = Join(programsArray, " // ")
Sheets("Sheet1").Cells(1, 3).Value = programElement