I have inserted the below code in the code window of Sheet1 but nothing happens when I enter something in lowercase.
Private Sub Worksheet_Change(ByVal Target As Range)With TargetIf Not .HasFormula ThenApplication.EnableEvents = False.Value = UCase(.Value)Application.EnableEvents = TrueEnd IfEnd WithEnd Sub
Can you help?
It worked just fine!
Please make sure that the code is inserted in the worksheet code module, not in a separate module.
To check that out, hover the move over the worksheet tab, right-click, and select View Code.
Then check if the code is inserted in there.
If so, it may be an error that prevents the event to be triggered, and to fix it, please update the code as follows:
Private Sub Worksheet_Change(ByVal Target As Range) On Error Resume Next With Target If Not .HasFormula Then Application.EnableEvents = False .Value = UCase(.Value) Application.EnableEvents = True End If End With On Error GoTo 0 End Sub
After that, save the workbook, and restart it to take effect.
Hope that helps