Upper case 1st letter only

  • Thread starter Thread starter jeff
  • Start date Start date
J

jeff

This is for when the value of a textbox is pasted.
I know that
Application.Selection.Value = UCase(TextBox2.Text)
will result in all caps. Is there a variation of the code that will
result in just the1st letter being in caps?
I searched but could not find any reference to this.
Thanks
jeff
 
Hi

You can use the worksheetfunction 'Proper' like this:

Application.Selection.Value = WorksheetFunction.Proper(TextBox2.Text)

Regards,
Per
 
If you really mean only the first letter should be in caps and all the rest
of the letters in lower case...

Selection.Value = UCase(Left(TextBox2.Text, 1) & LCase(Mid(TextBox2.Text,2)
 
Hi

You can use the worksheetfunction 'Proper' like this:

Application.Selection.Value = WorksheetFunction.Proper(TextBox2.Text)

Regards,
Per

"jeff" <[email protected]> skrev i meddelelsen



- Show quoted text -

Thanks!
Works just right.
I played around with it myself, but I just couldn't get it the syntax
right. I appreaciate the help.
j.o.
 
You can use the VBA function StrConv(). Try

Msgbox StrConv("jeff & jacob skaria",vbProperCase )

If this post helps click Yes
 
Back
Top