Jan 30 2020 02:11 PM - edited Jan 30 2020 02:19 PM
start recording a Macro
click on a URL (cell B8) this link does work
web page does open just fine
stop recording
When I play it back it will move the the target cell (B8) but then no click (select) takes place, it just stops there. When I look at the code it shoes this, why does it not work when played back?
Sub Macro10()
'
' Macro10 Macro
' 10
'
'
Range("B8").Select
End Sub
Jan 30 2020 11:38 PM - edited Jan 30 2020 11:39 PM
Replicated your case. Recorded a similar macro. The code I get looks like this:
Sub Macro1()
'
' Macro1 Macro
'
'
Range("A1").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End Sub
Jan 31 2020 08:06 AM
Thank you for showing your test! That showed me somthing but I still need help. I am sorry I did not completely describe what I was doing, can we try again please.
A3 is a cell I type a search term into such as jump rope
B3 has a formula to create the link with the contents of A3 inserted as follows:
=HYPERLINK("https://www.amazon.com/s?k="&A3&"&ref=nb_sb_noss_2")
When I click on the link it works fine
When the recorded macro selects B3 is it seeing the formula and not the hyperlink?
THANKS!
Jan 31 2020 09:03 AM
With some help of
https://docs.microsoft.com/en-us/office/vba/api/Excel.Workbook.FollowHyperlink
this seems to work:
Sub FollowHLink()
Dim Hlink As String
Range("A1").Select
Hlink = ActiveCell
ActiveWorkbook.FollowHyperlink Address:=Hlink
End Sub
Your hyperlink formula was entered in A1. Perhaps you can get it to work now.
Jan 31 2020 09:38 AM
Solution
The cell contained a formula to create the hyper-link and not the actual resultant, this was the key to searching for a solution.
I found an article that showed how to replace the formula in a cell with it's result
And now all works fine when recording a macro with a mouse click on a cell that has a calculated hype-link. I can't believe it was as simple as clicking F2 and then F9 as described here:
And best of all the new cells all copy down the column with variables in tackt and the resultant as intended.
Jan 31 2020 09:38 AM
Solution
The cell contained a formula to create the hyper-link and not the actual resultant, this was the key to searching for a solution.
I found an article that showed how to replace the formula in a cell with it's result
And now all works fine when recording a macro with a mouse click on a cell that has a calculated hype-link. I can't believe it was as simple as clicking F2 and then F9 as described here:
And best of all the new cells all copy down the column with variables in tackt and the resultant as intended.