+ Reply to Thread
Results 1 to 8 of 8

Trying to Find selected cell content within another worksheet cell range.

Hybrid View

  1. #1
    Registered User
    Join Date
    08-11-2009
    Location
    Lancashire England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Trying to Find selected cell content within another worksheet cell range.

    Hi

    I have a large SS containing details of 600+ artworks, adjacent to which I have multiple worksheets each containing details of where particular paintings are on display.

    Each item has a unique 'Ref No'. What I want is to select the cell containing the 'Ref No' then activate a macro via keystroke.

    I need the macro to copy the 'Ref No', select the range of cells on my main worksheet and then 'Find' that unique 'Ref No' and go to it.

    I have a simple macro to select the cell range on the main worksheet and open the Find dialog however I can't get the copy/paste into the Find dialog to work? What I have to do is manually type the 'Ref No' into the Find dialog and press Enter, I would like to automate this process.

    Sub Macro1()
    '
    ' Macro1 Macro
    '
    
        Application.Goto Reference:="a_All"
        Application.SendKeys "^f"
    
    
    End Sub
    I have attached a representative example of what I am trying to achieve.

    Any help much appreciated!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Trying to Find selected cell content within another worksheet cell range.

    Hello there try this

    Dim x As String
    
    x = ActiveCell.Value   'set the value of the activecell, unique ref number cell selected to x
    With Sheets("Detail List")    'with the worksheet Detail List
        .Select  'select the worksheet
        .Cells.Find(what:=x, after:=.Range("A1")).Activate   'find the cell whose value is equal to x and activate it
    End With
    to insert this code into your workbook

    1. Press Alt+F8 on your keyboard.
    2. Clear the macro name box and enter FindRefNo
    3. Then select the Create option
    4. In between the Sub FindRefNo( ) and End Sub copy and paste the above code.
    5. Exit out of Visual Basic.
    6. Press Alt+F8 again
    7. Select the FindRefNo macro and then selection Options
    8. Assign a Ctrl+ key to your macro. For this example place q in the empty box next to Ctrl+
    9. Select Okay and close the macro window.
    10. Select the cell whose ref number you want to search for and then hit Ctrl+q on your keyboard.

    Let me know if this works for you!

    Thanks!

  3. #3
    Registered User
    Join Date
    08-11-2009
    Location
    Lancashire England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Trying to Find selected cell content within another worksheet cell range.

    Hi

    Yes it works... Only thing is it takes a while to run. Is this because my worksheet 'Detail List' is currently up to cell AFX2272 (and still growing). The area of cells I need to do the search within A1:AB2272. Is it possible to specify the 'range to'?

    Many thanks
    Last edited by Craigside; 08-13-2012 at 04:10 PM. Reason: typo

  4. #4
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Trying to Find selected cell content within another worksheet cell range.

    update the code as follows:

    Dim x As String
    
    x = ActiveCell.Value   'set the value of the activecell, unique ref number cell selected to x
    With Sheets("Detail List")    'with the worksheet Detail List
        .Select  'select the worksheet
        .Range("A1:AB2272").Find(what:=x, after:=.Range("A1")).Activate   'find the cell whose value is equal to x and activate it
    End With

  5. #5
    Registered User
    Join Date
    08-11-2009
    Location
    Lancashire England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Trying to Find selected cell content within another worksheet cell range.

    WOW that's awesome! does it in milliseconds now.

    Thank you very much!

  6. #6
    Valued Forum Contributor
    Join Date
    03-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1,093

    Re: Trying to Find selected cell content within another worksheet cell range.

    No problem! Don't forget to mark this thread solved and maybe give me a little star tap if I helped!

    Thanks!

  7. #7
    Registered User
    Join Date
    08-11-2009
    Location
    Lancashire England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Trying to Find selected cell content within another worksheet cell range.

    How do i close it as solved? I've looked but can't see how?

  8. #8
    Registered User
    Join Date
    08-11-2009
    Location
    Lancashire England
    MS-Off Ver
    Excel 2007
    Posts
    34

    Re: Trying to Find selected cell content within another worksheet cell range.

    Ok many thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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