-
Aug 28th, 2012, 12:48 AM
#1
Thread Starter
New Member
copy hyperlink thread does solve drilldown sub part
This is exactly what I was looking for and it works except for one issue. It copies my hyperlinks to the next column but I have a DrillDown Sub Selection.ShowDetail = True. My hyperlinks point to other sheets in the workbook that have pivot tables. I wanted the users to be able to click on the hyperlink and see the detail behind the pivot cell it was pointing to instead of the summed total. This code does not copy the DrillDown Sub part. I apologize in advance but I don't know how to easily add that back in other than manually setting up each hyperlink again! There has to be a way to do this. Below is the code I found on this site that I tweaked to work with my workbook:
Sub HyperlinkMoveTest()
Dim aSheet As Worksheet 'Sheet Handle
Dim hLink As Hyperlink 'Hyperlink Handle
Dim rngDst As Range 'Destination Cell
Dim rngSrc As Range 'Source Cell
'Set a Handle for the working Sheet
Set aSheet = ActiveWorkbook.Sheets("Trending")
'Iterate through all the Hyperlinks in a range
For Each hLink In Selection.Hyperlinks
'Fetch the cell address of the source Hyperlink
Set rngSrc = hLink.Range
'Set the Destination Cell address based on the Source Cell address
Set rngDst = rngSrc.Offset(0, 1)
'Load the Destination Cell with the Hyperlink WITHOUT AFFECTING THE FORMAT !!!
aSheet.Hyperlinks.Add rngDst, hLink.Address, hLink.Range.Text
Next hLink
End Sub
Thank you in advance.
la.wells
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|