Hi - I'm new to VB and I was trying to write a function that accepts a string
as an argument and then returns as an integer value the number of vowels
in the string. Below is my attempt, but I can't get it to work for more then
one vowel e.g "E".

Thanks in advance

Kev

Function Vowelcounts(n As String) As Integer

totalvowel = 0

X = 0
i = 0

If X < 1 Then X = 1

For c = 0 To Len(n)

i = InStr(X, n, "E")
If i = 0 Then Exit Function

X = i + 1

totalvowel = totalvowel + 1
Vowelcounts = totalvowel

Next

End Function