小白,照抄书上代码,运行错误,提示“子过程或函数未定义”求大神帮忙给看看谢谢!!
代码::
Function Breakdown(rng As Range, Optional style As Byte = 1) As String
Application.Volatile
On Error Resume Next
Dim i As Integer, str As String
str = Sp1it(rng.Text, ",")(WorksheetFunction.RoundUp(style / 3, 0) - 1)
If style Mod 3 = 1 Then
For i = 1 To Len(str)
If VBA.IsNumeric(Mid(str, i, 1)) Then Exit Function
Breakdown = Breakdown & Mid(str, i, 1)
Next i
ElseIf style Mod 3 = 2 Then
For i = 1 To Len(str)
If VBA.IsNumeric(Mid(str, i, 1)) Or Mid(str, i, 1) = "." Then Breakdown = Breakdown & Mid(str, i, 1)
Next
ElseIf style Mod 3 = 0 Then
For i = Len(str) To 1 Step -1
If VBA.IsNumeric(Mid(str, i, 1)) Then Exit Function
Breakdown = Mid(str, i, 1) & Breakdown
Next i
End If
If Err <> 0 Then Breakdown = ""
End Function