自定义函数 Function GetNum(ByVal srtVal As String) As String Dim i As Integer, n As Integer For i = 1 To Len(srtVal) If 57 >= Asc(Mid(srtVal, i, 1)) And Asc(Mid(srtVal, i, 1)) >= 48 Then GetNum = GetNum & Mid(srtVal, i, 1) End If Next i GetNum = GetNum End Function Function GetNotNum(ByVal srtVal As String) As String Dim i As Integer, n As Integer For i = 1 To Len(srtVal) If 57 <= Asc(Mid(srtVal, i, 1)) Or Asc(Mid(srtVal, i, 1)) <= 48 Then GetNotNum = GetNotNum & Mid(srtVal, i, 1) End If Next i GetNotNum = GetNotNum End Function |