Solved

Insert Cell Link in Excel

Posted on 2009-05-04
7
803 Views
Last Modified: 2013-12-26
Hello all.

I have an excel spreadsheet with 3 columns of information.  I have another column with hyperlinks that execute macros.  Is it possible to select an area inside the Information cell range that I want to insert a row and push the 3 cells of information down a cell?

0
Comment
Question by:SchMoke
  • 3
  • 3
7 Comments
 
LVL 20

Expert Comment

by:pari123
Comment Utility
>>> Is it possible to select an area inside the Information cell range that I want to insert a row and push the 3 cells of information down a cell?

Yes, it is absolutely possible and there are also many ways to get this done. Here's one way that you can try:

After you select the desired cells you can use something similar.


Range("A2:C2".select
Selection.Insert Shift:=xlDown

This will move the cells down. To add a hyperlink you can use something like this:

    Range("A1").Select
    ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
        "http://www.yahoo.com", TextToDisplay:="LINK"

- Ardhendu

0
 
LVL 16

Expert Comment

by:Jerry Paladino
Comment Utility
Highlight the three cells you want to move down and right mouse click.  On the sub menu that displays select Insert.  In the dialog box that displays select Move Cells Down.
0
 

Author Comment

by:SchMoke
Comment Utility
Hey pari123, that is close to what i need but lets say I have in A4 the value "Dog" and in A6 the value "Cat".  I want to be able to click on A5 and then click the link and it will push "Cat" to A7.  Can the link do that?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 20

Expert Comment

by:pari123
Comment Utility

If you want to insert a link in A5, then your code will look something similar to this...

   Range("A5").select
   Selection.Insert Shift:=xlDown
   ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _
        "http://www.yahoo.com", TextToDisplay:="LINK"

This will shift only the values in Column A down and insert a link in A5.

- Ardhendu
0
 

Author Comment

by:SchMoke
Comment Utility
Ahhhh so how do I pass the Active cell to


Range("whatever cell i click on").select

because I may want to insert a space in another row in the column
0
 
LVL 20

Accepted Solution

by:
pari123 earned 250 total points
Comment Utility
If you want to click a cell, then you can try something like this .....

But remember that this will work only on one cell to insert the hyperlink.

- Ardhendu


Sub Newcode()

Dim rngX As Range
 

Set rngX = Application.InputBox(Prompt:="Please click on a cell with your mouse to insert the link.", _

                    Title:="SPECIFY RANGE", Type:=8)

rngX.Select

  Selection.Insert Shift:=xlDown

  ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:= _

       "http://www.yahoo.com", TextToDisplay:="LINK"

End Sub

Open in new window

0
 

Author Comment

by:SchMoke
Comment Utility
Worked like a charm!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now