AUTOMATIC UPPER CASE

GeorgeB

Board Regular
Joined
Feb 16, 2002
Messages
239
Anyone have some quick code to change input into a specific column into UPPER CASE when it is entered?
Probably simple but it's 3:00 AM and my brain quit functioning about an hour ago.
Thanks
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
You could use this. Put in sheet code,change column reference to your needs

Private Sub Worksheet_Change(ByVal Target As Range)
'will change letters in column B to caps when there are entered
Dim rng1 As Range, rng2 As Range, cell As Range

On Error GoTo errorhandler
Application.EnableEvents = False
If Not Intersect(Target, Columns(2)) Is Nothing Then
Set rng1 = Intersect(Target, Columns(2))
Set rng2 = Intersect(ActiveSheet.UsedRange, rng1)
For Each cell In rng2
If cell.Formula <> "" Then
cell.Formula = Format(cell.Formula, ">")
End If
Next cell
End If
errorhandler:
Application.EnableEvents = True
End Sub
 
Upvote 0
Thank you AJ, PaulB and Ian Mac for your responses.
AJ, I looked at Validation but wanted something more user friendly.
Paul, Your formula works perfectly. Any way to make it cover multiple columns?
And finally Ian Mac, thank you thank you for that web site reference. I downloaded the ASAP pack and it was so powerfull my monitor levitated when I installed it.
Have a great day.
 
Upvote 0
this is a bit simpler, for column B...

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then Target.Value = UCase(Target.Value)
End Sub


...add extra lines identical but with eg.3 instead of 2 for column C, for multiple columns, else for the whole sheet do this...

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Value = UCase(Target.Value)
End Sub
 
Upvote 0
Sorry for the late Thank you daleyman. Been out of town again. This is without a doubt the most simple way to accomplish what I wanted to do. Suggest adding On Error Resume Next to the top. Otherwise it errors out if you try to copy drag anything down.
Buena Surte a Todos
George
 
Upvote 0

Forum statistics

Threads
1,213,513
Messages
6,114,064
Members
448,545
Latest member
kj9

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top