开始提取 ❶ 首先是【开发工具】-【代码】-【Visual Basic】; ❷ 在弹出的界面中点击【插入】-【模块】; ❸ 将下列代码复制到模块中。
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
❹ 返回Excel界面,然后在需要提取单元格中录入: 【=myget(A2,1)】是提取所有中文
【=myget(A2,2)】是提取所有英文
【=myget(A2)】是提取所有的数据
|