Multiple Hyperlink/VBA Query

OscartheDog

New Member
Joined
Dec 3, 2019
Messages
2
Office Version
2016
Platform
Windows
Hi All

I was just wondering if anyone could help me with a Multiple Hyperlink/VBA query. I've tried multiple methods but none seem to be working.

I have a list of names where I want there to be a hyperlink option next to each individual name that will take the user to another page when clicked - it will also copy and paste the name they clicked into a certain cell (for example Sheet 2, Cell A1 - same sheet/cell for all individuals). I can do that using:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
If Target.Range.Address = "$G$4" Then
Call Macro1
End If
End Sub

with Marco1 copying the cell and pasting it into sheet 2.

Is there a way to use the above for a range of cells - otherwise this would have to be typed out 600 times+. This spreadsheet is something where names are added constantly so I just need to find a way to make this as automatic as possible without adding a new line to the above VBA.

Secondly, I need to find a way to add a hyperlink every time a new name is added to the list - of course it must refer to the cell it is so the above VBA would work.

It's a combination of these 2 things that I need/hope to get working.

I've already looked into the hyperlink function but this has issues - I'm not sure if you can run a macro from a click on a hyperlink function.

I can provide a sheet if needed or answer any questions but would really appreciate some help on this :)

Many Thanks

Oscar
 

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
7,149
Office Version
2019
Platform
Windows
Try changing the first line to something like
VBA Code:
If Not Intersect(Target, Range("D10:G100")) Is Nothing Then
Adjust the Range as needed.

For simplicity, I would suggest using Double Click instead of Hyperlink.
 

OscartheDog

New Member
Joined
Dec 3, 2019
Messages
2
Office Version
2016
Platform
Windows
Thank you so much! I'll be honest - I didn't even know Double Click existed but you learn something new every day!

I've made a few little tweaks and it's all up and running - so thanks again!
 

Forum statistics

Threads
1,081,680
Messages
5,360,498
Members
400,588
Latest member
SpannersWatson

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top