Thread: caps in cells
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default caps in cells

Clicking in a cell will not change the case of the string in a cell.

You could use some double-click event code if that's what you're thinking of.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Column 3 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
Cancel = True
ErrHandler:
Application.EnableEvents = True
End Sub


Or you could have the Upper case added as you type in the cell.
No doubleclick involved.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column 3 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Tue, 6 May 2008 13:33:57 -0700 (PDT), duckie wrote:

how do i always have upper case letters in some cells and not others
when I click on that cell