I wrote the following function, but do not see why I cannot print the items to see if the function works as intended. I get a type mismatch when I try to print the item.
Sub Test()
ExampleRaw = "234;BB-154;39a3"
SemiColonListToArray (ExampleRaw)
For Each Item In SemiColotListToArray
Debug.Print Item
Next Item
End Sub
Function SemiColonListToArray(semiColonList) As Variant
SemiColonListToArray = Split(semiColonList, ";")
End Function
CodePudding user response:
You got a typo in your For Each
loop and you are not actually assigning anything to your SemiColonListToArray
variable, try:
Sub Test()
ExampleRaw = "234;BB-154;39a3"
For Each Item In SemiColonListToArray(ExampleRaw)
Debug.Print Item
Next Item
End Sub
Function SemiColonListToArray(semiColonList) As Variant
SemiColonListToArray = Split(semiColonList, ";")
End Function