PDA

View Full Version : Solved: Selection Caps Locks



av8tordude
01-28-2013, 05:35 AM
I have this code that capitalizes the cell. Problem I'm facing it continuously loops because there is a change. Is there another ways of doing thins via VBA?

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Activate
Selection.Value = UCase(ActiveCell.Value)
End Sub

xld
01-28-2013, 06:21 AM
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range

On Error GoTo ws_exit

Application.EnableEvents = False

For Each cell In Target

cell.Value = UCase(cell.Value)
Next cell

ws_exit:
Application.EnableEvents = True
End Sub

av8tordude
01-28-2013, 06:25 AM
Thank XLD:friends:

snb
01-28-2013, 06:26 AM
Private Sub Worksheet_Change(ByVal Target As Range)
if target<>Ucase(target) and vartype(target)=8 then target= UCase(Target)
End Sub