Consulting

Results 1 to 4 of 4

Thread: Range Position and link to ranges

  1. #1
    VBAX Newbie
    Joined
    Mar 2009
    Posts
    2
    Location

    Range Position and link to ranges

    Hi, first post here - i have tried searching but cant find what i need.

    I am using excel 2007 in compatability mode as the end recipients are using 2003.

    I have created a work book and on the first page I have a table of hyperlinks that link to several named ranges in a second sheet. What I am looking to do is, when ever a link is followed, the named range is positioned as though it it was in A1. The ranges for the cells are only one cell in size, and are across row 1, underneath each of the ranges are pivot tables. So for example the following cells are named ranges a1, w1, aa1, ac1. when a user selects the link for AC1 i want AC1 to be in the top left corner of the excel window.

    Hope you can help.

    Thanks in advance.

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Welcome to the forum!

    Right click the sheet that it would goto, View Code, and paste:
    [VBA]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Column <> Range("AC1").Column Then Exit Sub
    With Application
    .EnableEvents = False
    .Goto Target, True
    .EnableEvents = True
    End With
    End Sub[/VBA]

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    or right-click in the sheet that has the table of hyperlinks and paste this:[vba]Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
    Application.Goto Selection, True
    End Sub
    [/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  4. #4
    VBAX Newbie
    Joined
    Mar 2009
    Posts
    2
    Location
    Thanks very much for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •