Need help creating hyperlinks using VBA

vt804boy

New Member
Joined
Jul 31, 2009
Messages
7
Im working on a database and I need to create a hyperlink depending on a value in a specific range cells. For example, the range is A1:A100, If there is a "Y" in this range then I need that "Y" to be converted to a hyperlink to another sheet in the same workbook.

If someone could tell me how to code a hyperlink I would greatly appreciate it.

Here is the code I have already its probably not correct. This is my best guess so far

Sub PlaceHyper()

Set MyRange = Range("A7:A1000")
For Each Cell In MyRange

If Cell.Value = "Y" Then
**Needed hyperlink code**
End If

End Sub

Thank you in advance
 
Hi
try these codes

Code:
Dim b As Long
For b = 2 To Range("A65536").End(xlUp).Row
If Cells(b, 1) = "Y" Then
Range("A" & b).Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
        "Sheet3!A1", TextToDisplay:="Y"
End If
Next b
MsgBox "Complete"
End Sub
it creates hyperlink to sheet3 cell A1 wherever Y is seen in col A
Ravi
 
Upvote 0

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