Results 1 to 4 of 4

Search for a value in a workbook, and return the Spreadsheet name where it was located.

Threaded View

  1. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Search for a value in a workbook, and return the Spreadsheet name where it was located

    Hello Quillie19,

    Here is some code that should help. It would be copied into the "General" section (very top) of the UserForm.
    Sub Example()
    
        Dim FoundIt As Range
        Dim What    As Variant
        Dim Wks     As Worksheet
        
            What = TextBox1.Value
            
            For Each Wks In Worksheets
                Set FoundIt = Wks.UsedRange.Find(What, , xlValues, xlWhole, xlByRows, xlNext, False, False, False)
                If Not FoundIt Is Nothing Then
                    TextBox2.Value = FoundIt.Address(External:=True)
                    TextBox3.Value = FoundIt.Offset(0, 1).Value
                    Exit Sub
                End If
            Next Wks
            
    End Sub
    EDIT: You will need to change the names of the TextBoxes to what you have named them.
    Last edited by Leith Ross; 04-03-2015 at 06:42 PM.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Vba to Return the Term located between first two Dashes
    By jordan2322 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-14-2012, 12:32 AM
  2. Need a way to search a whole workbook and return the lowest row that contains data
    By LFDallas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-14-2011, 05:26 PM
  3. Replies: 7
    Last Post: 07-28-2011, 10:05 AM
  4. Replies: 2
    Last Post: 02-23-2009, 12:02 AM
  5. Search in excel by date located in a cell
    By Btobin0 in forum Excel General
    Replies: 6
    Last Post: 05-27-2006, 10:25 AM

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