Link if certain text is entered

cagni

New Member
Joined
Aug 1, 2022
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hi All

Looking for a macro that can copy the link from a certain cell if YES is entered in another cell.

For example in F10 we have text "Link" with a link that links to a pdf in a certain folder. I want a macro that takes this link and add to any cell in column F only if text YES is entered. Then make the "YES" as a link as well with the link from F10.

This will be the same for G10, H10, I10, J10 and so on.

If this possible at all.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Can also be that it doesn´t have to copy the link from cell F10 but just use certain link for that specific row.
 
Upvote 0
I have worked a little on this and have found this code and worked a little with it. Would it be possible to apply to this code that it has to take the link from f.eks. F5 which is an active link?

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rangeLimit As Range

Set rangeLimit = Range("F10:F1999")

If Not Intersect(rangeLimit, Target) Is Nothing Then
If Target = "YES" Then
Target.Hyperlinks.Add Anchor:=Target, Address:="LINK", SubAddress:="Sheet2!A1", TextToDisplay:=Target.Value
End If
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,262
Members
449,075
Latest member
staticfluids

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