Consulting

Results 1 to 7 of 7

Thread: Solved: search help

  1. #1
    VBAX Tutor
    Joined
    Dec 2009
    Posts
    295
    Location

    Solved: search help

    hi
    i need help with a macro:
    i attached a file.

    in sheet 1 i have a data table in sheet2 i have a result table
    i need a macro with a push button to search in the "serial" column in sheet1
    and the data in the sheet2 will belong to the serial


    thanks

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Use a formula

    =INDEX(Sheet1!$I$7:$I$35,MATCH($B1,INDEX(Sheet1!$A$7:$H$35,0,MATCH(Sheet2!$ A1,Sheet1!$A$3:$H$3,0)),0))
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You can do this without macros
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Tutor
    Joined
    Dec 2009
    Posts
    295
    Location
    hi
    thanks for the reply
    but like i said i need a macro with a button
    because i need to explain to my emplyes i need them to press the button write a serial number and get instent results
    so please help with a macro it is critical for the production


    thanks

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    try this
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    VBAX Tutor
    Joined
    Dec 2009
    Posts
    295
    Location
    hi thanx

    this is approximatly what i need but i changed the combobox1 to textbox1
    i just need that if the number that i write is not in the column
    write msgbox "no mach found"

    thanks

  7. #7
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Try this code

    [vba]

    Private Sub CommandButton1_Click()
    Dim c As Range

    Set c = Sheets("Sheet1").Columns(9).Find( _
    What:=TextBox1.Text, _
    lookat:=xlWhole)
    If c Is Nothing Then

    MsgBox "Value not found, try again"
    Else

    c.Offset(, -8).Resize(, 8).Copy

    Sheets("Sheet2").Cells(1, 2).PasteSpecial Paste:=xlValues, Transpose:=True

    Unload UserForm1
    Application.CutCopyMode = False

    Worksheets("Sheet2").Activate
    End If
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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