How do I make some columns all caps and others proper?

R

rmm30

I am new to excel and do not have macro experience. I wd like to make
columns 1-6 All Caps when i hit tab or enter. then I want another
column to format proper caps when hit tabe or enter.

I copied a macro from this forum to make the first 6 columns ALL CAPS
which is working beautifully, see following:

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


How do i now make column 7 format proper?
 
B

Bernie Deitrick

rmm30,

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
If Target.Column <= 6 Then
Target.Value = UCase(Target.Value)
Else
Target.Value = Application.Proper(Target.Value)
End If
ErrHandler:
Application.EnableEvents = True
End Sub

HTH,
Bernie
MS Excel MVP
 

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