hyperlink address offset to select

l_eonandr

New Member
Joined
Feb 18, 2016
Messages
25
Can anyone help with this;
I download a set of data which has hyperlinks which are not correct. I have a macro that changes the address of each link.
While inside the loop I need to go to the new hyperlink address and capture some data from the url then past it in a range
of cells addressed from the cell location of the current hyperlink.


example; hyperlinks are located in column "A" starting with row 5 then skip two rows and another hyperlink.
The Range of cells to past new data to would start with the current hyperlink, say the loop has updated the hyperlink
located in cell (A,11) Then the data should be writen beginning with (C, 10).
Code:
Sub HyperLinkChange()


    Dim hl As Hyperlink
    
    For Each hl In ActiveSheet.Hyperlinks
        hl.Address = Replace(hl.Address, "getscoutticket", "getwellprod")
      
    Next hl
    
End Sub

This is what I think I need to add to follow the hyperlink, copy the data and past to the worksheet where the hyperlink is located, but it does not work.

Code:
 ActiveCell.Range(don't know what to put here).Select


        Selection.Hyperlinks(1).Follow NewWindow:=True, AddHistory:=True
        ActiveCell.Offset(-1, 2).Range("A1").Select
        ActiveSheet.PasteSpecial Format:="HTML", Link:=False, DisplayAsIcon:=False, NoHTMLFormatting:=True

Can anyone suggest a code that follow the hyperlink that has changed inside the loop and copy the data then past to the cells located an offset from the cell containing the hyperlink?
Much appreciate any help or suggestions.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,223,238
Messages
6,170,939
Members
452,368
Latest member
jayp2104

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