Author Topic: insert Hyperlink in Excel to another cell in Excel  (Read 4149 times)

0 Members and 1 Guest are viewing this topic.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
insert Hyperlink in Excel to another cell in Excel
« on: July 09, 2015, 03:16:33 PM »
I have searched everywhere I can, and I have not been able to find how to hyperlink from a cell on Sheet1 to a cell on Sheet2 via VBA.  I have an example that works if typed exactly the way they show, but if I try to switch out for my tab names, it crashes.  I will post the code that works (got to go copy it from the site i found it on
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: insert Hyperlink in Excel to another cell in Excel
« Reply #1 on: July 09, 2015, 03:19:36 PM »
Code: [Select]
Sheets("Sheet3").Hyperlinks.Add Sheets("Sheet3").Cells(3, 3), "", Sheets("Sheet1").Name & "!B2", "", "Hello"
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: insert Hyperlink in Excel to another cell in Excel
« Reply #2 on: July 09, 2015, 03:30:46 PM »
Try this. Substitute "SHEET 1" and "THIS IS SHEET 3" with your sheet names.

Code: [Select]
Sub Test()
    Sheets("This is sheet 3").Select
   
    Range("C3").Select
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
        "'Sheet 1'!B2"
    ActiveCell.FormulaR1C1 = "'Hello"
End Sub
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: insert Hyperlink in Excel to another cell in Excel
« Reply #3 on: July 10, 2015, 09:43:27 AM »
Well it took a while, but your example worked GREAT!  thanks
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Matt__W

  • Seagull
  • Posts: 12955
  • I like my water diluted.
Re: insert Hyperlink in Excel to another cell in Excel
« Reply #4 on: July 10, 2015, 09:46:11 AM »
You're welcome
Autodesk Expert Elite
Revit Subject Matter Expert (SME)
Owner/FAA sUAS Pilot @ http://skyviz.io

accent@pdq.net

  • Guest
Re: insert Hyperlink in Excel to another cell in Excel
« Reply #5 on: July 13, 2015, 12:13:38 PM »
We are looking for AutoCad VBA consultant. We developed a Visual Basic plug-in for AutoCad, which works well on AutoCad 12 WindowsXP. AutoCad limited the Visual Basic support for AutoCad 13 (maybe 14 as well), but re-introduced for  AutoCad 2015. We need some VBA programming support for our AutoCad plug-in for 64-bit Windows 7 and AutoCad 15+.

Please contact me.

Mark
Universe Technical Translation, Inc.
mark@universe.us
713-8278800