View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default How do I set all caps as the default?

Some modifications to original code.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Const WS_RANGE As String = "A1, A5"
'add more cells if needed
'like "A1, A5, A10, B1, B5"
On Error GoTo ErrHandler
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
For Each cell In Target
Target.Formula = UCase(Target.Formula)
Next cell
End If
ErrHandler:
Application.EnableEvents = True
End Sub


Gord

On Tue, 11 Dec 2007 18:12:06 -0800, Mark Barnard
wrote:

Dear Mr. Dibben,

It worked perfectly...thank u!

Now, if I want to get really cute, can I do the same thing, only for two
particular cells?

A little history may help...I am writing this for an aviation application.
Each airport in the world is identified by a unique 4-letter identifier. I
have a cell for the departure airport and the destination airport. The user
wants these two cells in all upper case. The remaining cells he wants to
remain in title case.

Sorry to be a pain...if it's a hassle, don't worry about it. You and Mike
have been great help already.

Sincerely,

Mark