-
Picky Picky. You didn't say it needed to deal with multiple words.
[VBA]
Private Sub TextBox1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
Dim arr
Dim x
Dim t
arr = Split(TextBox1, " ")
For x = 0 To UBound(arr)
If Left(arr(x), 2) = "mc" Then
arr(x) = UCase(Left(arr(x), 1)) & "c" & UCase(Mid(arr(x), 3, 1)) & Right(arr(x), Len(arr(x)) - 3)
ElseIf Left(arr(x), 3) = "mac" Then
arr(x) = UCase(Left(arr(x), 1)) & "ac" & UCase(Mid(arr(x), 4, 1)) & Right(arr(x), Len(arr(x)) - 4)
ElseIf Left(arr(x), 2) = "o'" Then
arr(x) = UCase(Left(arr(x), 2)) & UCase(Mid(arr(x), 3, 1)) & Right(arr(x), Len(arr(x)) - 3)
Else
arr(x) = UCase(Left(arr(x), 1)) & Right(arr(x), Len(arr(x)) - 1)
End If
Next
For x = 0 To UBound(arr)
t = t & " " & arr(x)
Next
TextBox1 = Trim(t)
End Sub[/VBA]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules