|
3#
楼主 |
发表于 2006-2-15 01:16:00
|
只看该作者
以下是引用wang1950317在2006-2-7 9:47:00的发言:
本栏有位专家给出一个自定义函数flw2,(你可以搜索一下),在模块中添加如下代码:
Function FLW2(X As Range, Y As Integer)
If Y = 1 Then
For I = 1 To Len(X)
If Val(Mid(X, I, 1)) > 0 Or Mid(X, I, 1) = "0" Or Mid(X, I, 1) = "+" Or Mid(X, I, 1) = "-" Or Mid(X, I, 1) = "*" Or Mid(X, I, 1) = "/" Or Mid(X, I, 1) = "^" Or Mid(X, I, 1) = "mod" Or Mid(X, I, 1) = "." Or Mid(X, I, 1) = "(" Or Mid(X, I, 1) = ")" Then
Q = Q & Mid(X, I, 1)
End If
FLW2 = Application.Evaluate(Q)
Next I
ElseIf Y = 2 Then
For M = 1 To Len(X)
A = Application.WorksheetFunction.Substitute(X.Value, 0, "")
B = Application.WorksheetFunction.Substitute(A, 1, "")
C = Application.WorksheetFunction.Substitute(B, 2, "")
D = Application.WorksheetFunction.Substitute(C, 3, "")
E = Application.WorksheetFunction.Substitute(D, 4, "")
F = Application.WorksheetFunction.Substitute(E, 5, "")
G = Application.WorksheetFunction.Substitute(F, 6, "")
H = Application.WorksheetFunction.Substitute(G, 7, "")
I = Application.WorksheetFunction.Substitute(H, 8, "")
J = Application.WorksheetFunction.Substitute(I, 9, "")
Next M
FLW2 = J
End If
End Function
在B1中调用这个函数即可。
我觉得头晕得很!!!!!!!!!!!!!1[em06][em06] |
|