Tôi có hàm tự tạo ( củ chuối ) như sau :
Private Function TRICH(CHU As String, J As Integer) As String
Dim I As Integer
Dim strText() As String
CHU = UCase(Trim(CHU))
CHU = Application.WorksheetFunction.Substitute(CHU, "//", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\\", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "(", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ")", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "'", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ";", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ",", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ".", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
strText = Split(CHU, Space(1))
J = J - 1
TRICH = Trim(strText(J))
End Function
Cách sử dụng như file đính kèm.Các bạn chưa thấy hay thì cải tiến giùm mình nhé.Thành hàm mảng càng tốt.cám ơn
Private Function TRICH(CHU As String, J As Integer) As String
Dim I As Integer
Dim strText() As String
CHU = UCase(Trim(CHU))
CHU = Application.WorksheetFunction.Substitute(CHU, "//", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/ /", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\\", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\ \", " 0 ")
CHU = Application.WorksheetFunction.Substitute(CHU, "/", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "\", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "(", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ")", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, "'", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ";", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ",", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, ".", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
CHU = Application.WorksheetFunction.Substitute(CHU, " ", " ")
strText = Split(CHU, Space(1))
J = J - 1
TRICH = Trim(strText(J))
End Function
Cách sử dụng như file đính kèm.Các bạn chưa thấy hay thì cải tiến giùm mình nhé.Thành hàm mảng càng tốt.cám ơn