Câu hỏi mới: Nhờ Thầy nào online giúp đỡ giùm em với.
Nhờ Thầy giúp giùm em, thêm code cho hàm diễn giải có hàm round, em muốn xóa chữ "round(" thì Ok, còn đối số cuối của số làm tròn em cắt chưa được), phân cách công thức ở máy em là dấu ;
Đọc trên diễn đàn thấy mã asc số 59, nhưng cũng chưa bắt được cái dấu ; ở cuối hàm round.
Em cảm ơn Thầy
Public Function diengiai(rngData As Range)
Dim strText As String, strText2 As String
Dim i As Long, j As Long, dem As Long
Dim subText() As String, dau() As String
Dim Res As Double
strText = rngData.Formula
For i = 1 To Len(strText)
Select Case Mid(strText, i, 1)
Case "+", "-", "*", "/", "^"
ReDim Preserve dau(j)
dau(j) = Mid(strText, i, 1)
j = j + 1
End Select
Next i
strText = Replace(strText, "=", "")
strText = Replace(strText, ":", "")
strText = Replace(strText, "#", "")
strText = Replace(strText, "{", "(")
strText = Replace(strText, "}", ")")
strText = Replace(strText, "[", "(")
strText = Replace(strText, "]", ")")
strText = Replace(strText, "+", "@")
strText = Replace(strText, "-", "@")
strText = Replace(strText, "*", "@")
strText = Replace(strText, "/", "@")
strText = Replace(strText, "", "@")
strText = Replace(strText, "^", "@")
'strText = Replace(strText, ";", "#")
If Left(strText, 6) = "ROUND(" Then
strText = Replace(strText, "ROUND(", "")
strText = Split(strText, ";")(0)
End If
strText = Trim(strText)