|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
用vba解决
在EXCEL中,编制一宏(如附件中的cccc),该宏的内容如下:
*******************************************************
Sub cccc()
Function MyGet(Srg As String, Optional n As Integer = False)
Dim i As Integer
Dim s, MyString As String
Dim Bol As Boolean
For i = 1 To Len(Srg)
s = Mid(Srg, i, 1)
If n = 1 Then
Bol = Asc(s) < 0
ElseIf n = 2 Then
Bol = s Like "[a-z,A-Z]"
ElseIf n = 0 Then
Bol = s Like "#"
End If
If Bol Then MyString = MyString & s
Next
MyGet = IIf(n = 1 Or n = 2, MyString, Val(MyString))
End Function
***********************************************
假如你在A1单位格中输入的字符串为“2005680000/啦啦队一队/ laladui ccc www 可思考",
则在结果单位格中(如B1)输入公式:=MyGet(A1,1),则B1的结果就为:"啦啦队一队可思考" |
|