Paste Email Address without Hyperlink property

Anne Troy

MrExcel MVP
Joined
Feb 18, 2002
Messages
2,632
Office Version
  1. 365
Platform
  1. Windows
I want a user to be able to paste email addresses into certain cells, let's say D3, and D5 through D7, and when they do, the email address is pasted, the font is dropped to lower case, and the hyperlink property does NOT exist.

I am already using the following code, so I can alter it for the lowercase portion,

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Cells.Count > 1 Then
        Exit Sub
    End If
    On Error GoTo ErrHandler:
    If Not Application.Intersect(Me.Range("C10:D10"), Target) Is Nothing Then
        If IsNumeric(Target.Value) = False Then
            Application.EnableEvents = False
            'Target.Value = StrConv(Target.Text, vbLowerCase)
            'Target.Value = StrConv(Target.Text, vbUpperCase)
            Target.Value = StrConv(Target.Text, vbProperCase)
            Application.EnableEvents = True
        End If
    End If
ErrHandler:
    Application.EnableEvents = True
End Sub[code]


and I know how to find code to remove hyperlinks in EXISTING data, but not in new data. 

Code I've tried doesn't work. I'm sorry I don't have that code anymore, so I can't show you what didn't work.

Bottom line, can you alter the code above to work for me? Thanks so much in advance!!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Maybe

Code:
With Target
    .Value = StrConv(Target.Text, vbProperCase)
    .Hyperlinks.Delete
End With
 
Upvote 0
Try like this

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then
    Exit Sub
End If
On Error GoTo ErrHandler:
If Not Application.Intersect(Me.Range("C10:D10"), Target) Is Nothing Then
    If IsNumeric(Target.Value) = False Then
        Application.EnableEvents = False
        'Target.Value = StrConv(Target.Text, vbLowerCase)
        'Target.Value = StrConv(Target.Text, vbUpperCase)
        With Target
            .Value = StrConv(Target.Text, vbProperCase)
            .Hyperlinks.Delete
        End With
        Application.EnableEvents = True
    End If
End If
ErrHandler:
Application.EnableEvents = True
End Sub
 
Upvote 0
That works great! Thanks so much. I'm about to post an issue with the change event on that same code.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

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