1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Function EvaluateString(txtstring As Variant) As Variant
Dim i As Integer, L As Integer
Dim txtArray As Variant, txtArray2d As Variant
txtArray = Split(txtstring, "),(")
If IsEmpty(txtArray) Then L = 0 Else L = UBound(txtArray)
'remove leading "(" and last ")"
txtArray(0) = Replace(txtArray(0), "(", "")
txtArray(L) = Replace(txtArray(L), ")", "")
ReDim txtArray2d(0 To L, 1 To 2)
For i = 0 To L
txtArray2d(i, 1) = Split(txtArray(i), ",")(0)
txtArray2d(i, 2) = Trim(Split(txtArray(i), ",")(1))
Next i
EvaluateString = txtArray2d
End Function |
Partager