All Caps Code Help

motherteresa

Board Regular
Joined
Nov 11, 2010
Messages
81
I have this All Caps code which works great. But, it also turns all emails on the worksheet into caps, which I don't want.

Question:
Is there a way to have it work on everything except emails and web addresses?

or

Is there a way to have it work on everything except certain cells?


Thank you Ex(cel)perts!!;)
 
Or, sticking with my no Exit Sub preference

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cel As Range, MyRange As Range
    
    If Target.Cells.Count = 1 And Target.HasFormula = False Then
        On Error Resume Next
        Application.EnableEvents = False
        If InStr(Target.Value, "@") = 0 Then
            Target = UCase(Target)
        End If
    
        If Not Intersect(Target, Range("C:C, E:E")) Is Nothing Then
            Select Case Target.Column
                Case 5
                    If Target > 0 Then Target = -Target
                Case 3
                    If Target < 0 Then Target = -Target
            End Select
        End If
        Application.EnableEvents = True
    End If
End Sub
 
Upvote 0

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Add it right before the "End If" statement? And, will it stop the macro for the whole page or just in cells with a formula? Oh...didn't see dj's thought. Will try them both. Thanks guys. Wish me luck!!
 
Last edited:
Upvote 0
Looks like it's working pretty well so far djreiswig. Thanks too, Smitty for looking in on the issue. Y'all have a wonderful Thanksgiving!!;)
 
Upvote 0

Forum statistics

Threads
1,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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