{"id":12098,"date":"2011-11-26T09:15:09","date_gmt":"2011-11-26T09:15:09","guid":{"rendered":"http:\/\/www.learnexcelmacro.com\/?p=829"},"modified":"2011-11-26T09:15:09","modified_gmt":"2011-11-26T09:15:09","slug":"textbox-first-letter-in-caps","status":"publish","type":"post","link":"https:\/\/vmlogger.com\/excel\/2011\/11\/textbox-first-letter-in-caps\/","title":{"rendered":"Textbox first Letter in Caps and Rest other in Lowercase"},"content":{"rendered":"

If you want to automatically make first letter in Uppercase and rest of the characters in lowercase. No matter what case you are typing-in but it will be automatically done by Copying and Pasting the below Code under KeyPress Event of the Textbox <\/strong><\/p>\n

\n\nPrivate Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)\n\nSelect Case KeyAscii\nCase Asc(\"A\") To Asc(\"Z\")\n        If InStr(1, TextBox1.Text, Chr(KeyAscii)) > 0 Or TextBox1.SelStart > 0 Then\n            KeyAscii = Asc(LCase(Chr((KeyAscii.Value))))\n            Else\n            KeyAscii = Asc(UCase(Chr((KeyAscii.Value))))\n        End If\n                     \nCase Asc(\"a\") To Asc(\"z\")\n        If InStr(1, TextBox1.Text, Chr(KeyAscii)) > 0 Or TextBox1.SelStart > 0 Then\n            KeyAscii = Asc(LCase(Chr((KeyAscii.Value))))\n            Else\n            KeyAscii = Asc(UCase(Chr((KeyAscii.Value))))\n        End If\n      \n Case Else\n End Select\n\nEnd Sub\n<\/code><\/pre>\n

Read This Also:<\/strong><\/p>\n