自定义函数,ALT+F11可以查看代码:
Function FLW(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) = "." Then
FLW = FLW & Mid(X, I, 1)
End If
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
FLW = J
End If
End Function |