DEFAULT TO UPPER CASE

  • Thread starter Thread starter Guest
  • Start date Start date
Turn on Caps Lock or use event code to change to UPPER case as you enter text.

This code operates on all sheets in the workbook.

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

This is event code. Right-click on the Excel logo left of "File" on the menubar
or left end of Title Bar if window is not maximized.

Select "View Code". Copy/paste the code into that Thisworkbook module.

*******************************

To operate on just one worksheet use this code.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

Right-click on the sheet tab and "View Code". Copy/paste into that Sheet
module.


Gord Dibben MS Excel MVP
 
Gord your vb works great it but how can I narrow it down to just one column
(I2:I250). There are several individuals using this sheet and some have less
computer smarts than I do which is not much.
 
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Not Application.Intersect(Range("I2:I250"), Target) Is Nothing Then
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
End If
ErrHandler:
Application.EnableEvents = True
End Sub


Gord
 

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

Back
Top