+ Reply to Thread
Results 1 to 5 of 5

Thread: look up name click on name, match & take to data sheet

  1. #1
    Registered User
    Join Date
    01-21-2012
    Location
    Orange Co, USA
    MS-Off Ver
    Excel 2010
    Posts
    2

    look up name click on name, match & take to data sheet

    Am a newbie to this forum. Posted this morning as was unclear this time have included a sample attached

    Looks like vlookup the match to display data on another worksheet.

    Thanks for you patience.
    Attached Files Attached Files

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: look up name click on name, match & take to data sheet

    This can be done with an event macro built into your misspelled Names& Data sheet.


    Option Explicit
    
    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Excel.Range, Cancel As Boolean)
    Dim vFIND As Range, vFIRST As Range
    
    On Error Resume Next
    With Sheets("Names& Data")
        Select Case Target.Column
            Case 3, 8
                Set vFIND = .Range("B:B").Find(Target.Value, LookIn:=xlValues, LookAt:=xlWhole)
                If Not vFIND Is Nothing Then
                    Do
                        If vFIND.Offset(, -1).Value = Target.Offset(, 1).Value Then
                            Cancel = True
                            .Activate
                            vFIND.EntireRow.Select
                            Exit Do
                        End If
                        Set vFIRST = vFIND
                        Set vFIND = .Range("B:B").FindNext(vFIND)
                    Loop Until vFIND.Address = vFIRST.Address
                Else
                    MsgBox "Not found"
                    Exit Sub
                End If
    
            Case 4, 9
                Set vFIND = .Range("A:A").Find(Target.Value, LookIn:=xlValues, LookAt:=xlWhole)
                If Not vFIND Is Nothing Then
                    Do
                        If vFIND.Offset(, 1).Value = Target.Offset(, -1).Value Then
                            Cancel = True
                            .Select
                            vFIND.EntireRow.Select
                            Exit Do
                        End If
                        Set vFIRST = vFIND
                        Set vFIND = .Range("A:A").FindNext(vFIND)
                    Loop Until vFIND.Address = vFIRST.Address
                Else
                    MsgBox "Not found"
                    Exit Sub
                End If
        End Select
    End With
    
    End Sub

    How/Where to install the macro:

    1. Open up your workbook
    2. Right-click on the sheet tab and select View Code
    3. Copy and Paste in your code (given above)
    4. Get out of VBA (Press Alt+Q)
    5. Save as a macro-enabled workbook (*.xlsm)


    Now doubleclick on any name and if it exists on the other sheet, you will be taken there.
    Attached Files Attached Files
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Valued Forum Contributor
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    382

    Re: look up name click on name, match & take to data sheet

    You might try using hyperlinks to defined named ranges...

  4. #4
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,228

    Re: look up name click on name, match & take to data sheet

    Quote Originally Posted by dangelor View Post
    You might try using hyperlinks to defined named ranges...
    Eek! 800 separate named ranges.... I don't recommend that.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  5. #5
    Valued Forum Contributor
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    Excel 2003, 2007, 2010
    Posts
    382

    Re: look up name click on name, match & take to data sheet

    After seeing your solution , neither do I!

+ Reply to Thread

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.2.0