Results 1 to 8 of 8

Creating Search Macro

Threaded View

  1. #1
    Registered User
    Join Date
    07-13-2009
    Location
    Fairfax, Virginia
    MS-Off Ver
    Excel 2003
    Posts
    4

    Creating Search Macro

    Hi,

    I am writing a macro to search the range A1:A70 on all worksheets in a workbook. The macro will pull up an input box for a user to type in a part number and should find the location of the part number in its corresponding worksheet.

    The code I have so far looks like this...
    --
    Sub Search_v2()
    '
    ' Search_v2 Macro
    ' Macro recorded 7/9/2009 by MGD
    '
    
    '
    SearchValue = InputBox("Enter a p/n to search. NOTE: Base numbers may be in use.", "Component Search")
    
    With Worksheets("1995128-002").Range("a3:a70")
        Set c = .Find(SearchValue, LookIn:=xlValues)
        If Not c Is Nothing Then
            firstAddress = c.Address
            Do
                Set c = .FindNext(SearchValue, LookIn:=xlValues)
                
          End If
          
    End With
              
    End Sub
    --

    Does any of this look correct at all? I'd really appreciate the help. Thanks.
    Last edited by vtmickster; 07-13-2009 at 10:23 AM. Reason: Code wrapped

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