I need help please.
I want to ensure cell text is AllCaps within a range.
For reasons I won't go into, I cannot have code in a Module so it's on the Worksheet itself.
I suspect it's something to do with the sub listed below.
I can enter a letter in a cell, select another cell to trigger the code and the letter converts to UpperCase, but my worksheet then locks up. I can only get things working as expected by changing sheet tab, then changing back to the hanging sheet and I can continue selecting and the case converts to Upper OK from then on.
I have included the code I suspect, although it may be an unrelated error.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not (Application.Intersect(Target, Range("S6:AY65")) _
Is Nothing) Then
With Target
If Not .HasFormula Then
Application.EnableEvents = False
.Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
End If
End Sub
I just tried running it with the above code deleted and it seems to work fine, which is no good as I must convert any single text input to AllCaps
ps. I run Excel 2013 in Compatability mode
Thanks for any help
Peter
I want to ensure cell text is AllCaps within a range.
For reasons I won't go into, I cannot have code in a Module so it's on the Worksheet itself.
I suspect it's something to do with the sub listed below.
I can enter a letter in a cell, select another cell to trigger the code and the letter converts to UpperCase, but my worksheet then locks up. I can only get things working as expected by changing sheet tab, then changing back to the hanging sheet and I can continue selecting and the case converts to Upper OK from then on.
I have included the code I suspect, although it may be an unrelated error.
Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
If Not (Application.Intersect(Target, Range("S6:AY65")) _
Is Nothing) Then
With Target
If Not .HasFormula Then
Application.EnableEvents = False
.Value = UCase(.Value)
Application.EnableEvents = True
End If
End With
End If
End Sub
I just tried running it with the above code deleted and it seems to work fine, which is no good as I must convert any single text input to AllCaps
ps. I run Excel 2013 in Compatability mode
Thanks for any help
Peter
Last edited: