?
Solved

excel hyperlink function within vba

Posted on 2010-09-20
8
Medium Priority
?
815 Views
Last Modified: 2012-05-10
I am using the following VBA expression but the interpreter complains that its invalid:
Worksheets("sheet1").Range("J13").Formula = "=HYPERLINK(""http://www.google.com"" | ""GOOGLE"")"

I am simply trying to create a hyperlink inside a cell. I know the excel function =HYPERLINK("http://www.google.ca"|"GOTO www.google.ca")
is correct, why does it not work in VBA?

I am using Excel 2010.
0
Comment
Question by:OTNAdmin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 33

Expert Comment

by:jppinto
ID: 33719546
Please trt like this:

Worksheets("sheet1").Range("J13").Formula = "HYPERLINK("http://www.google.com";"GOOGLE")"

jppinto
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 33719576
Try This:


Worksheets("sheet1").Range("J13").Select
ActiveCell.FormulaR1C1 = _
        "=HYPERLINK(""http://www.google.ca"",""GOTO www.google.ca"")"

-Brandon
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 33719582
Parameters to Excel functions should be seperated by commas...
Worksheets("sheet1").Range("J13").Formula = "=HYPERLINK(""http://www.google.com"", ""GOOGLE"")"
 
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Accepted Solution

by:
KnutsonBM earned 2000 total points
ID: 33719602


This one has the wording you wanted:


Worksheets("sheet1").Range("J13").Select
ActiveCell.FormulaR1C1 = _
        "=HYPERLINK(""http://www.google.com"",""Google"")"

-Brandon
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33719649
The correct way to do it, instead of using the .Formula is to use .Hyperlinks, like this:

Worksheets("Sheet1").Range("B3").Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= "http://www.google.com/", TextToDisplay:="GOOGLE"

jppinto
0
 
LVL 33

Expert Comment

by:jppinto
ID: 33719664
Or even better:

ActiveSheet.Hyperlinks.Add Anchor:=Range("B3"), Address:= "http://www.google.com/", TextToDisplay:="GOOGLE"

jppinto
0
 
LVL 6

Expert Comment

by:KnutsonBM
ID: 33719721
Many different options to choose from................

-brandon
0
 

Author Comment

by:OTNAdmin
ID: 33719831
thanks
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question