Change case

  • Thread starter Thread starter Ben Allen
  • Start date Start date
B

Ben Allen

I have a form which i want to change the case of entries when a button is
clicked. In word i can see this feature, but it is not there in Excel. I
need one text box to be converted to all caps and one to be converted to
title case.
Thanks in advance

--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"
 
Cells(x, y).Value = StrConv(Cells(x, y).Value, vbProperCase)
Cells(x, y).Value = StrConv(Cells(x, y).Value, vbUpperCase)

Try that. - Piku
 
Private Sub CommandButton1_Click()
TextBox1.Text = UCase$(TextBox1.Text)
TextBox2.Text = StrConv(TextBox2.Text, vbProperCase)
End Sub
 
Steve said:
Private Sub CommandButton1_Click()
TextBox1.Text = UCase$(TextBox1.Text)
TextBox2.Text = StrConv(TextBox2.Text, vbProperCase)
End Sub
Thanks Steve, That worked great.
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is enough!"
 
Use Ucase method to change to upper case. there is no sentence case method so you have to do it progromatically
Like this: string = ucase(left(string,1) ) & right(string,len(srting)-1)
 
Actually for Sentence Case, Tushar Mehta has a much better
algorithm. i.e.
First sentence. Second sentence. Third Sentence.

Sentence_Case, Re: Use VBS RegExp to replace a-z with A-Z?, Tushar Mehta, programming, 2002-08-04.
http://google.com/[email protected]

Also read about Regular Expressions to understand Tushar's macro.
http://www.mvps.org/dmcritchie/excel/grove_digitsid.htm#regexp

More information on changing of case in
Proper, and other Text changes -- Use of SpecialCells
http://www.mvps.org/dmcritchie/excel/proper.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top