Macro for removing friendly names

SR1

Board Regular
Joined
Dec 4, 2007
Messages
77
Hello,

I need a macro that will replace the friendly of hyperlinked text with just the URL in a selected range of cells (can be either single or multiple selection).

(eg BBC news website as just http://news.bbc.co.uk)

The spreadsheet contains nearly 200 rows and this would obviously save a lot of time.

Thanks if you could help!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Code:
Public Sub ProcessData()
Const TEST_COLUMN As String = "A"    '<=== change to suit
Dim i As Long
Dim LastRow As Long
Dim cell As Range

    With Application
        
        .ScreenUpdating = False
        .Calculation = xlCalculationManual
    End With
    
    With ActiveSheet
        
        LastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
        For i = 1 To LastRow
        
            .Cells(i, "A").Value = .Cells(i, "A").Hyperlinks(1).Address
        Next i
    End With
    
    With Application
        
        .Calculation = xlCalculationAutomatic
        .ScreenUpdating = True
    End With
    
End Sub
 
Upvote 0
Try this.....select the range of cells and run the macro:
Code:
Sub RemoveFriendlies()
Dim iRange As Range, r As Range
Set iRange = Selection
For Each r In iRange
    With r.Hyperlinks(1)
        .TextToDisplay = .Address
    End With
Next r
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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