Code for Hyperlink

jrtdcg

New Member
Joined
Dec 4, 2012
Messages
45
Hi All,
I've been doing some searching regarding hyperlinks, but can't seem to find a near match for what I'm trying to accomplish.

I have a workbook that is generating a review process from the current user in the workbook. The process involves a lot of different steps. Everything seem to be working well within the review process except for the hyperlink. What I'd like to do is have the code look at the current path and provide a hyperlink to a cell within the spreadsheet. After the workbook has been renamed from the review process the next user has a direct like from the previous workbook. The problem that I'm having now is my code only show a link to the folder and the link won't open. I'd like for it to show the entire path directly to the file so that the file will open when it hyperlink is clicked.

Currently showing up in cell D1:
S:\Sales_Data\Q2014\010186-10901 Roosevelt Island- S046FD0- XX SEPS- D XXXXX\Latest Revision to Customer

This is what should be showing up in cell D1:
S:\Sales_Data\Q2014\010186-10901 Roosevelt Island- S046FD0- XX SEPS- D XXXXX\Latest Revision to Customer\10186-10901.xlsm

<tbody>
</tbody>

<tbody>
</tbody>

<tbody>
</tbody>

See below:
Code:
'--------------------This is where I'm currently putting the filename path 
Range("D1").Select
        ActiveCell.FormulaR1C1 = ActiveWorkbook.Path
    
   
'---------------This where I copy from one workbook to the other workbook and add the hyperlink

    Windows("Approval_Review.xlsm").Activate
Sheets("Bill of Material").Select
    Range("D1").Select
    Selection.Copy
     Windows("book1.xlsx").Activate
    Range("C40").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Dim cell As Range
For Each cell In Intersect(Selection, ActiveSheet.UsedRange)
If cell <> "" Then
ActiveSheet.Hyperlinks.Add cell, cell.Value
End If
Next

Any help would be appreciated....Thanks in advance!!!

J.R.
 
I think I have problem identified...now. Just not sure of the fix. The hyperlink that is copied from one workbook to the other workbook works fine. It appears that the link is lost when the new workbook is saved under another name. In my code I copy and paste then rename the file.
 
Upvote 0

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,215,941
Messages
6,127,794
Members
449,408
Latest member
Bharathi V

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