I've written this function which works, now I want to be able to call it as a worksheet function as in the pics, any guidance would be welcome:
There are two parts to the array separated by a semi-colon.
Function CellToRange(strDelimiter As String, Optional strColDelimiter As String) As String
On Error GoTo CellToRange_Error
Dim rnSource, rnDest As Range
Dim i As Integer
Dim Orig As Variant
Dim txt As String
Dim intPos As Integer
Set rnSource = Range("F16")
Set rnDest = Range("D21")
txt = rnSource
Orig = Split(txt, strDelimiter)
intPos = InStr(1, txt, strColDelimiter) / 2
For i = 0 To intPos - 1
If i = intPos - 1 Then
rnDest.Offset(i).Value = Mid(Orig(i), 1, InStr(1, Orig(i), strColDelimiter) - 1)
Else
rnDest.Offset(i).Value = Orig(i)
End If
Next i
For i = intPos - 1 To UBound(Orig)
If i = intPos - 1 Then
rnDest.Offset(i - (intPos - 1), 1).Value = Mid(Orig(i), InStr(1, Orig(i), strColDelimiter) + 1, Len(Orig(i)))
Else
rnDest.Offset(i - (intPos - 1), 1).Value = Orig(i)
End If
Next i
On Error GoTo 0
Exit Function
CellToRange_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure CellToRange of Function Functions"
End Function
Here be dragons. Haven't tryed this before and I hope I understood you right.
At this moment it takes source cell, where numbers are located, and destination cell, which is top left cell of output table. Currently delimiters are "," and ";" for lines and columns respectively.
You can modify sub to suit your needs from this point.
P.S. I might be wrong but this will be the closest as you can get with modifying cells with UDF.
P.P.S. Welp, my Function actualy returns surprising results, I'll try to fix it asap, but mb you have other suggestions.