Skip to content

Instantly share code, notes, and snippets.

@longtth
Last active November 6, 2017 14:49
Show Gist options
  • Save longtth/e2076a284aa94a7668321b905e487ae5 to your computer and use it in GitHub Desktop.
Save longtth/e2076a284aa94a7668321b905e487ae5 to your computer and use it in GitHub Desktop.
' rng: Cell chứa chuỗi cần cắt
' c : chuỗi con dùng làm delimiter
' n : vị trí chuỗi con cần lấy (bắt đầu từ 0)
Function TokenizeAt(rng As Range, c As String, n As Integer)
Dim ret As String
If (rng.Cells.Count > 1) Then
ret = "Only allow 1 cell"
End If
Dim strArr() As String
strArr = Split(rng, c)
ret = strArr(n)
TokenizeAt = ret
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment