All Capitals

L

lostinformulas

is there a VB code that will change the case to all Capitals regardles
of what is typed in worksheet!!!
 
M

Michael M

Hi
Try using the UPPER function.

=UPPER(A1) will convert what is in A1 to Upper case

HTH
Michael M
 
B

Bearacade

This is from the Microsoft board.

Becareful you don't have too big of a range.. your workbook will b
busy for a long time ...

Sub Uppercase()

For Each x In Range("A1:A5")
x.Value = UCase(x.Value)
Next

End Su
 
L

lostinformulas

Thanks,,

=Upper didn't work due to other condition in the cell


Bearacada,

Sub Uppercase()

worked perfect is there away for it to run automatically
 
G

Gord Dibben

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

As written, operates on Columns A:H as you enter text in a cell.

Change the 8 to whatever you wish.

This is event code and must go into the sheet module.

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


Gord Dibben MS Excel MVP
 
Top