침실3_EXCEL

EXCEL 함수- TEVALUATE 수식을 값으로

다식군! 2022. 6. 5. 18:28
반응형

사용자 정의 함수

 

 

TEVALUATE(사용자정의함수 코드).txt
0.00MB

Ctrl+V

Function TEVALUATE(ByVal strTemp As String) As Double
Dim strMe As String
Dim strF As String
Dim strG As String
Dim i As Integer, j As Integer
    i = Len(strTemp)
    For j = 1 To i
        strF = Mid(strTemp, j, 1)
        If IsNumeric(strF) Then
        Else
            Select Case strF
                Case "*", "/", ".", "+", "-", "^", "(", ")", "%"
                Case "×"
                    strF = "*"
                Case "÷"
                    strF = "/"
                Case "+"
                    strF = "+"
                Case "-"
                    strF = "-"
                Case Else
                    strF = ""
            End Select
        End If
        strMe = strMe & strF
    Next j

If strTemp = "" Then strMe = 0
If strMe = "" Then strMe = 0

TEVALUATE = Evaluate(strMe)
End Function
반응형