Auto change font to 'capital letters'

G

Guest

Hi,
is it possible to change data entered into any cell so that it appears as
CAPITAL LETTERS without actualy placing a formula (=UPPER(A2) into each cell.
I want this to apply to the whole worksheet.

thanks
 
J

Jason Morin

Right-click the worksheet tab, select View Code, and
insert the code below:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Application.EnableEvents = False
With Target
If .Count = 1 Then
.Value = UCase(.Value)
End If
End With
Application.EnableEvents = True
End Sub

---
Press ALT+Q to close and return to XL.

HTH
Jason
Atlanta, GA
 
G

Guest

Jason
,thanks for your help , I had to adjust it a little but it works fine,
regards
Anthony
 
K

Ken Wright

Is there any chance you will enter any formulas on this page at all? If so
then you need to catch those and not convert them else you will lose the
formulas as soon as you hit ENTER, so with a slight addition to Jason's code

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Application.EnableEvents = False
With Target
If .Count = 1 And .HasFormula = False Then
.Value = UCase(.Value)
End If
End With
Application.EnableEvents = True
End Sub
 

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

Top