Selection of a line via combobox

DAMMON Posted messages 25 Registration date   Status Member Last intervention   -  
cs_Le Pivert Posted messages 8437 Status Contributor -
Hello,
Thank you for the responses to our various needs.
I come once again to ask how to automatically select the row corresponding to the data of a cell that I select in the combobox?

I have a combo box fed from a sheet; which allows me to select the "name" from the "Name" column of the sheet, and with a "Validate" button, I display the data of that row in the user form that contains several text boxes. Now I would like that when I click the "Validate" button, the row corresponding to the data that appears is automatically selected.

Thank you in advance for the response

Configuration: Windows 8 / Internet Explorer 10.0

--
"The apple of the Eternal's eye"

2 answers

  1. gbinforme Posted messages 14930 Registration date   Status Contributor Last intervention   4 744
     
    Hello,

    I display the data from this row in the userform

    So you have the "row number" and you just need to do:
    Rows("row number").Activate or Rows("row number").Select

    --
    Always zen
    Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupéry
    0
    1. DAMMON Posted messages 25 Registration date   Status Member Last intervention  
       
      Hello
      There is no fixed line. It could be any line. That's actually my request. If the line number is known, there is no problem at all.
      0
    2. gbinforme Posted messages 14930 Registration date   Status Contributor Last intervention   4 744
       
      Hello,

      How do you make "appear the data of this line in the userform"?
      0
  2. cs_Le Pivert Posted messages 8437 Status Contributor 730
     
    Hello,

    by simply using the index of the comboBox, like this:

    Option Explicit Private Sub CommandButton1_Click() Dim line As Integer line = ComboBox1.ListIndex Range(line + 1 & ":" & line + 1).Select End Sub Private Sub UserForm_Initialize() Dim j As Integer 'Retrieve data from column A... For j = 1 To Range("A65536").End(xlUp).Row ComboBox1 = Range("A" & j) '...and filter duplicates If ComboBox1.ListIndex = -1 Then ComboBox1.AddItem Range("A" & j) Next j End Sub 


    --
    @+ The Woodpecker
    0
    1. DAMMON
       
      Thank you for your response; I will test it and let you know. Thank you.
      0
      1. cs_Le Pivert Posted messages 8437 Status Contributor 730 > DAMMON
         
        Mets comme te l'a indiqué gbinform( que je salue)

        Rows(line + 1).Select


        à la place de:

        Range(line + 1 & ":" & line + 1).Select


        voilà
        0