function in VBA to make uppercase text

-2

Good afternoon. How to make uppercase truncates of just a few cells of a form mounted on an excel worksheet? Cells in numeric fields and e-mails should not change. I only found formulas and functions for single cells, columns, or the entire worksheet, but I need some cells to alternate in columns and rows.

    
asked by anonymous 10.04.2017 / 18:53

2 answers

0

Via VBA, you can associate the following code with the 'Change' event in the Sheets module:

Private Sub Worksheet_Change(ByVal Target As Range)

    On Error Resume Next
        If Not Intersect(Target, Range("A1:B20")) Is Nothing Then
            Application.EnableEvents = False
            Target = UCase(Target)
            Application.EnableEvents = True
            End If
    On Error GoTo 0

End Sub
    
10.04.2017 / 20:56
0

You can force the user to type in capital letters only via Data Validation. Select the range, and then click Data Validation. In 'Allow', select the 'Custom' option and in the 'Formula' field enter the =EXATO(A1;MAIÚSCULA(A1)) function.

(if your Excel is in English, just copy the texts from the image)

    
10.04.2017 / 21:11