+ Reply to Thread
Results 1 to 4 of 4

use two column values in inputbox to select a row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    05-07-2013
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    122

    use two column values in inputbox to select a row

    Helo!

    I have a database in excel for devices for each device I have 11 columns! To modify or delete a device I have created 2 inputbox that will ask the user to enter the value of 2 columns: The SN (serial number) and HT (manufacturer)
    If the values in each input box correpond to the same row in the database i want to select the entire row and put the selection in a listbox (I've done this job with only one inputbox with the following code):


    Sub Imoddevice()
    Dim SN As String
    
    
    
    SN = InputBox("Enter serial number ", vbOKCancel)
    
    
    If SN = "" 
    
    If SN = "" And HT <> "" Then
    MsgBox " Error in SN  input"
    Userinterface.Show
            
    Else
    For j = Range("E65536").End(xlUp).Row To 1 Step -1
        If Range("E" & j) = SN Then a = Range("E" & j).EntireRow.Select
        a = Selection.Row
    Next j
    
    Load moddevice
    
             moddevice.ListBox2.List = Selection.Value
                      moddevice.Show
    End If
    End Sub
    I want to add another inputbox to ask the user to enter the manufacturer because sometimes two devices can have the same SN!

    For example if the SN and HT that the user has entered correspond to the same row, I want to select the row
    If the SN correspond to a row and the HT correspond to another row , I want to put an error message that says: "SN or HT error"

    Anyone can help??
    Thanks!!

  2. #2
    Forum Contributor
    Join Date
    05-07-2013
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: use two column values in inputbox to select a row

    here is the excel file if it can helps you: on the interface from left to right:
    add device
    modify device
    delete device
    (it is in german because i am doing an intership in a german biomedical company)
    Thanks!!
    VBA_Database(08.05.2013).xlsm

  3. #3
    Registered User
    Join Date
    04-22-2013
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003/2007 & 2010
    Posts
    90

    Re: use two column values in inputbox to select a row

    Why not use a little userform with two input options to get S/N and Manfufacturer name/ number at once?

  4. #4
    Forum Contributor
    Join Date
    05-07-2013
    Location
    France
    MS-Off Ver
    Excel 2007
    Posts
    122

    Re: use two column values in inputbox to select a row

    Yeah I had the same idea! But how you compare the row of both selection ?

+ 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.6.0 RC 1