2.在宏窗口上“停止錄制”
3.工具-宏-宏,點擊macro1-編輯,進入壹個窗口,把裏面的內容全部刪除,粘貼下面代碼:
Function GetNum(b)
Dim i As Integer
Dim Al As String
For i = 1 To Len(b)
Al = Mid(b, i, 1)
If IsNumeric(Al) Or Al = "." Then
GetNum = GetNum & Al
End If
Next
End Function
選中壹個單元格後,輸入: =getnum(a1)
如果提取不是數字的,就改成:
Function Getstr(b)
Dim i As Integer
Dim Al As String
For i = 1 To Len(b)
Al = Mid(b, i, 1)
If not IsNumeric(Al) Then
Getstr= Getstr & Al
End If
Next
End Function
選中壹個單元格後,輸入: =getstr(a1)