Excel-VBA: Tạo công thức (Function) tách số trong chuỗi

 



Mở VBA: add funtion này vào và sử dụng như công thức:


Function GetNumeric(CellRef As String)

Dim StringLength As Integer

StringLength = Len(CellRef)

For i = 1 To StringLength

If IsNumeric(Mid(CellRef, i, 1)) Then Result = Result & Mid(CellRef, i, 1)

Next i

GetNumeric = Result

End Function


Kết quả:



Nhận xét