我想计算仅出现在选定文本中的所有逗号“,”之后我将使用 Count asInteger
来运行loop
我的问题是我如何计算,
如下图所示:
我不知道如何使用split
和ubound
。以下代码有什么问题?
Sub CountComma()
Dim x As String, count As Integer, myRange As Range
Set myRange = ActiveDocument.Range(Selection.Range.Start, Selection.Range.End)
x = Split(myRange, ",")
count = UBound(x)
Debug.Print count
End Sub