Splitting hyperlinks

aa2000

Board Regular
Joined
Aug 3, 2011
Messages
87
Hi folks

I have a worksheet which contains relative hyperlinks which cannot be opened by a macro unless they are absolute hyperlinks.

Currently the hyperlinks take to form:

../../../../Project_Name/etc

Now I am trying to write a macro to replace the first part (up till /Project_Name) with the beginning of the absolute path.

My current code is:

Code:
Sub repair()

Set rangelink = Sheet7.Range("A1:A864")

For Each cell In rangelink

x = cell.Hyperlinks.Item(1).Address
If x Like "../../../../*" Then
cell.Value = "\\ABSOLUTE_PATH\" + x

End If
Next cell
End Sub

The problem here is that the absolute path is added before the "../../../../" of the relative path.
How can I modify the code such that the y = x without the "../../../../"?

i.e. the string x is split at the end of "../../../../" and only the text after it is set as the string y?

Cheers

 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,224,514
Messages
6,179,223
Members
452,896
Latest member
IGT

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