Option Explicit
Dim FLAG As Boolean
Public Sub Worksheet_Change(ByVal Target As Range)
‘Função para entrar converter letras minusculas em maiusculas
Dim MaiscStr As String, C1, C2
Select Case Target.Cells.Count
Case Is > 1
For Each C1 In Range(Target.Address)
For Each C2 In Range(“A1:A10″) ‘Intervalo pode ser alterado
If C1.Address = C2.Address Then
If FLAG Then
MsgBox FLAG
Selection.Delete
FLAG = Not FLAG
Exit Sub
End If
MsgBox “Não é permitido arrastar e/ou ” & _
“selecionar” & vbCr & “várias células ” & _
“Neste intervalo.”, vbInformation, “Aviso”
Desfaz
Exit Sub
End If
Next C2
Next C1
Exit Sub
Case Else
If Application.Intersect(Range(Target.Address), _
Range(“A1:A10″)) Is Nothing Or _
Target.Value = “” Then Exit Sub ‘ o intervalo pode ser alterado
End Select
With Target
If .HasFormula = False Then
MaiscStr = UCase(.Value)
Application.EnableEvents = False
.Value = (MaiscStr)
End If
End With
Application.EnableEvents = True
End Sub
Sub Desfaz()
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End Sub