|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 截取()
- Dim c$
- For k = 2 To [b65536].End(3).Row
- char = Trim(Cells(k, 2).Text)
- L = Len(char): s = InStr(char, "*")
- If s > 0 Then
- mychar = "*"
- For i = s + 1 To L
- c = Mid(char, i, 1)
- If IsNumeric(c) Then mychar = mychar & c
- If IsChar(c) Then mychar = mychar & c: Exit For
- If Not (IsNumeric(c) Or IsChar(c)) Then Exit For
- Next
- Else
- mychar = ""
- For i = s + 1 To L
- c = Mid(char, i, 1)
- If IsNumeric(c) Then mychar = mychar & c Else Exit For
- Next
- End If
- Cells(k, 3).Value = mychar
- Next
-
- End Sub
- Function IsChar(char As String) As Boolean
- If InStr("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", char) > 0 Then
- IsChar = True
- Else
- IsChar = False
- End If
- End Function
复制代码 |
|