Link to home
Start Free TrialLog in
Avatar of JMO9966
JMO9966

asked on

How to count the number of delimiters in a string - VBA

I need to be able to calculate the number of periods in a string variable using Excel VBA.

What's a good way to do so?

Example:

1.1 = 1
1.1.1 = 2
1.1.1.1 = 3

Thanks
ASKER CERTIFIED SOLUTION
Avatar of bromy2004
bromy2004
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Woops
Sub test()
Dim Str() As String
Dim Delim As Integer
Const YourValue As String = "1.1.1.1"


Str = Split(YourValue, ".")
Delim = UBound(Str)

End Sub

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JMO9966
JMO9966

ASKER

Thanks