Search code examples
vbaexcelexcel-2010

VBA Instant conversion of letters to Uppercase upon population of Excel Cell


I am looking for a macro that will automatically be activated upon event.

If someone inserts a text value or a value that has text on cell A1 once he presses enter and the cell has been populated if there is somewhere a lowercase letter it will convert it to uppercase.

However the catch is that it must be automatically without having to fire-up the macro yourself.


Solution

  • Private Sub Worksheet_Change(ByVal Target As Range)
        If Target.Address = "$A$1" Then
            Target.Value = UCase(Target.Value)
        End If      
    End Sub
    

    Tested only in worksheet code.