Results 1 to 6 of 6

Follow Cell Reference

Threaded View

  1. #1
    Registered User
    Join Date
    02-08-2012
    Location
    Gloucester, MA
    MS-Off Ver
    Excel 2010
    Posts
    10

    Follow Cell Reference

    I am trying to execute what i think should be a fairly simple command, but i'm having a tough time getting it to work the way I want. I want the program to follow the selected cells reference and select that. Essentially exactly the same function as the CTRL+[ shortcut. I tried to just record that shortcut, but to no avail.

    Sub Macro()
    '
    ' Macro when i record “Ctrl+[“
    '
        Application.Goto Reference:="'Sheet2'!R[1048550]C[16366]"
    End Sub
    This just takes me to a random cell on the sheet i was trying to reach. If i change this to read R[0]C[0], it takes me to the same cell but on the new sheet (Sheet1!B3 to Sheet2!B3, for example) regardless of where the original cell is referenced to.

    I did some searching on the net, and found someone with the same problem as me from a few years ago. However there was no working solution posted to his question that i could uncover. This is the code he found, but niether he or I could get it to work. It's a bit beyond my VBA ability to effectively analyze what this is doing and fix it.

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    Dim strSheet As String
    'On Error Resume Next
    If InStr(1, Target.Formula, "!") Then
    If InStr(1, Target.Formula, "'") Then
    strSheet = Mid(Replace(Target.Formula, "'", ""), 2, InStr(1, Target.Formula, "!") - 4)
    Else
    strSheet = Mid(Target.Formula, 2, InStr(1, Target.Formula, "!") - 2)
    End If
    Sheets(strSheet).Activate
    ActiveSheet.Range(CStr(Right(Target.Formula, Len(Target.Formula) - InStr(1, Target.Formula, "!")))).Select
    End If
    End Sub
    Any help would be greatly appreciated! I'm sure there is a simple fix for this, but i couldn't uncover it.
    Last edited by Alkuan; 02-08-2012 at 09:52 AM. Reason: Solved

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1