|
- Function CheckStr(strVal As String, Optional intCheck As Integer = 7, Optional strChar As String = ",") As String
- Dim strSplit() As String
- Dim intVal() As Integer
- Dim intID As Integer
-
- strSplit = Split(strVal, strChar)
-
- ReDim intVal(LBound(strSplit) To UBound(strSplit)) As Integer
-
- For intID = LBound(strSplit) To UBound(strSplit)
- intVal(intID) = Int(strSplit(intID))
- Next
-
- If Application.WorksheetFunction.Max(intVal) - Application.WorksheetFunction.Min(intVal) >= intCheck Then
- CheckStr = strVal
- Else
- CheckStr = ""
- End If
- End Function
- Sub Test()
- Debug.Print CheckStr("0,3,5,7,9")
-
- Debug.Print CheckStr("0,3,5,7,9", , ",")
-
- End Sub
复制代码 |
|