VBA - Select range and add hyperlink

John_vba

New Member
Joined
Aug 4, 2016
Messages
2
Hi all,

So I have this excel file with a lot of different hyperlinks which paths need to be updated every quarter.
However I do not want to update all of them at the same time since they all have a different path. What I'd like to do is to (1) enter the range of the hyperlink I want to edit in an InputBox then (2) delete the hyperlink that's already in this cell and (3) Add a new hyperlink in this cell by enter a new path in an InputBox.

I managed to write something to complete steps 1 and 2 but then I don't know where to go from there ...

Code:
Sub test_range
Dim rng As Range

On Error Resume Next
  Set rng = Application.InputBox(prompt:="Enter range", Type:=8)
  If rng Is Nothing Then
    MsgBox "Cancelled"
  Else
    rng.Select
  End If
ActiveCell.Hyperlinks.Delete

' create a new hyperlink that you enter in an InputBox

End Sub

Thanks guys I already lost an entire afternoon at work ...

John
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
anyone? I've got a deadline on this and I'm kind of stuck at the moment, any help would be appreciated! Thanks so much
 
Upvote 0

Forum statistics

Threads
1,215,233
Messages
6,123,772
Members
449,123
Latest member
StorageQueen24

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