0% found this document useful (0 votes)
5 views

FĐFDSD

The document describes a function that takes an expression as input, cleans it, and converts it to a standard mathematical format to be evaluated. The function removes certain characters and symbols from the expression, and replaces others to create a valid expression that can be evaluated.

Uploaded by

Tá Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

FĐFDSD

The document describes a function that takes an expression as input, cleans it, and converts it to a standard mathematical format to be evaluated. The function removes certain characters and symbols from the expression, and replaces others to create a valid expression that can be evaluated.

Uploaded by

Tá Nguyễn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Function DValue(Expr)

Char = Expr
Sent = Space(0)
ABC = "0123456789+-*/()." & Space(1)
XYZ = "0123456789" & Space(1)
For m = 2 To 3
Met = "m" & m
Temp = InStr(1, Char, Met)
Do While Temp > 0
If Temp > 0 Then
Char = Left(Char, Temp) & Mid(Char, Temp + 2)
End If
Temp = InStr(1, Char, Met)
Loop
Next
For i = 1 To Len(Char)
KyTu = Mid(Char, i, 1)
If InStr(1, ABC, KyTu) > 0 Then
Sent = Sent & KyTu
Else
Select Case KyTu
Case ":"
Left_ = Mid(Char, i - 1, 1)
Right_ = Mid(Char, i + 1, 1)
If InStr(1, XYZ, Right_) > 0 Then
Sent = Sent & "/"
End If
Case ","
Sent = Sent & "."
Case "%"
Sent = Sent & "/100"
Case "x", "X"
Left_ = Mid(Char, i - 1, 1)
Right_ = Mid(Char, i + 1, 1)
If InStr(1, XYZ, Right_) > 0 Then
Sent = Sent & "*"
End If
End Select
End If
Next
DValue = Eval(Sent)
End Function

You might also like