Macro to select hyperlink formula

Hannah89

New Member
Joined
Oct 16, 2011
Messages
2
Hi all,

Ive got this macro used to search for a particular code in an excel sheet with about 4000 codes, each assigned a hyperlink.

my goal is to make the user enter the hyperlink automatically in the code upon hitting search.

So far this is what i have:

the problem is that it only works with hyperlinks which are assigned a link (right click assign hyperlink) and not codes which work with a formula for example =HYPERLINK("http://www.google.com", "ABC123")

Sub searchsheet()

'Opens box and ask what do they want to search
searchthis = InputBox("Type in a location keyword.", "Property Search")
'Tells where to search
Columns("A:BO").Select
'and then search in them whatever the user entered:
Selection.Find(What:=searchthis, After:=ActiveCell, LookIn:= _
xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
xlNext).Activate
'if found go to first found
'if not found show message box saying it cannot be found


End Sub


Sub Macro2()
'
' Macro2 Macro
'

'
Application.Run "Book1!searchsheet"
Selection.Hyperlinks(1).Follow
End Sub

Is there anyone that can help me out?

Thanks
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
This is how I would "follow" the hyperlink of the active cell's Hyperlink() formula:

Code:
Sub FollowHyperlinkFormula()
Dim HLForm As String

HLForm = ActiveCell.Formula
HLForm = Mid(HLForm, InStr(HLForm, "http"), InStrRev(HLForm, """,") - InStr(HLForm, "http"))
ActiveWorkbook.FollowHyperlink Address:=HLForm, NewWindow:=True

End Sub
 
Upvote 0

Forum statistics

Threads
1,224,416
Messages
6,178,509
Members
452,853
Latest member
philipnjk64

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