|
Current Special! Complete Excel
Excel
Training Course
for Excel 97 - Excel 2003, only $145.00.
$59.95 Instant
Buy/Download,
30 Day Money Back Guarantee & Free
Excel Help for LIFE!
Force Text to Upper Case or Proper Case. See Also Change Text to Upper/Proper Case
We can use Excel VBA code in the Private Module of the Worksheet Object to force any text entered to be UPPER case, or Proper case. To use either of the first 4 Excel VBA procedures below, right click on the Worksheet name tab, select View Code and in here paste one and one only of the 4 procedures directly below. Note that 2 of the procedures restricts the forcing of upper/proper case to a specified range on the Worksheet. The other 2 similar procedures will do the same but for the entire Worksheet.
Private Sub Worksheet_Change(ByVal Target As Range) '''''''''''''''''''''''''''''''''''''''''''' 'Forces text to UPPER case for the range A1:B20 '''''''''''''''''''''''''''''''''''''''''''' If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub On Error Resume Next If Not Intersect(Target, Range("A1:B20")) Is Nothing Then Application.EnableEvents = False Target = UCase(Target) Application.EnableEvents = True End If On Error GoTo 0 End Sub Private Sub Worksheet_Change(ByVal Target As Range) '''''''''''''''''''''''''''''''''''''''''''' 'Forces all text to UPPER case '''''''''''''''''''''''''''''''''''''''''''' If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub On Error Resume Next Application.EnableEvents = False Target = UCase(Target) Application.EnableEvents = True On Error GoTo 0 End Sub Private Sub Worksheet_Change(ByVal Target As Range) '''''''''''''''''''''''''''''''''''''''''''' 'Forces text to Proper case for the range A1:B20 '''''''''''''''''''''''''''''''''''''''''''' If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub On Error Resume Next If Not Intersect(Target, Range("A1:B20")) Is Nothing Then Application.EnableEvents = False Target = StrConv(Target, vbProperCase) Application.EnableEvents = True End If On Error GoTo 0 End Sub Private Sub Worksheet_Change(ByVal Target As Range) '''''''''''''''''''''''''''''''''''''''''''' 'Forces all text to Proper case '''''''''''''''''''''''''''''''''''''''''''' If Target.Cells.Count > 1 Or Target.HasFormula Then Exit Sub On Error Resume Next Application.EnableEvents = False Target = StrConv(Target, vbProperCase) Application.EnableEvents = True On Error GoTo 0 End Sub
Force Text to Upper Case/Proper Case TextBox ControlThe excel VBA codes below can be used in an ActiveX TextBox control to force UPPER or Proper case.
Private Sub TextBox1_Change() On Error Resume Next TextBox1 = UCase(TextBox1) On Error GoTo 0 End Sub Private Sub TextBox1_Change() On Error Resume Next TextBox1 = StrConv(TextBox1, vbProperCase) On Error GoTo 0 End Sub
See Also Change Text to Upper/Proper Case
Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money
Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.
Instant Download and Money Back Guarantee on Most Software
Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!
Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft
Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel
| MSSQL Migration
Toolkit |
Monte Carlo Add-in |
Excel
Costing Templates