Worksheet_Change event causes worksheet hang

peterinth

New Member
Joined
Jun 1, 2010
Messages
3
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
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Have you tried creating a brand new workbook with JUST the 'suspect' code in it? Because I did that and it worked fine.

Which would suggest that it's not your suspect code, but some interaction betweeen the suspect code and the rest of your code.

I'd suggest posting the whole thing
 
Upvote 0

Forum statistics

Threads
1,215,982
Messages
6,128,099
Members
449,419
Latest member
mammothzaa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top