excel2003中已定义好2个函数,如何再定义1个函数在不同条件下调用这两个函数?
excel2003中已用VBA已定义好2个函数js1(x)、js2(x),代码如下。如何再定义1个函数js(x):当js1(x)返回的是数值时,让js(x)返回js1(x...
excel2003中已用VBA已定义好2个函数js1(x)、js2(x),代码如下。如何再定义1个函数js(x):当js1(x)返回的是数值时,让js(x)返回js1(x)的数值;否则返回js2(x)的结果?
Function js1(x)
WithCreateObject("MSScriptControl.ScriptControl")
.Language = "vbscript"
Do While InStr(1, x, "]") > 0
a = InStr(1, x, "[")
b = InStr(1, x, "]")
x = Left(x, a - 1) & Right(x, Len(x) -b)
Loop
js1 = .Eval(x)
End With
End Function
Function js2(x)
WithCreateObject("Access.Application")
Do While InStr(1, x, "]") > 0
a = InStr(1, x, "[")
b = InStr(1, x, "]")
x = Left(x, a - 1) & Right(x, Len(x) -b)
Loop
js2 = .Eval(x)
End With
End Function 展开
Function js1(x)
WithCreateObject("MSScriptControl.ScriptControl")
.Language = "vbscript"
Do While InStr(1, x, "]") > 0
a = InStr(1, x, "[")
b = InStr(1, x, "]")
x = Left(x, a - 1) & Right(x, Len(x) -b)
Loop
js1 = .Eval(x)
End With
End Function
Function js2(x)
WithCreateObject("Access.Application")
Do While InStr(1, x, "]") > 0
a = InStr(1, x, "[")
b = InStr(1, x, "]")
x = Left(x, a - 1) & Right(x, Len(x) -b)
Loop
js2 = .Eval(x)
End With
End Function 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询