Selection of a line via combobox
DAMMON
Posted messages
25
Registration date
Status
Member
Last intervention
-
cs_Le Pivert Posted messages 8437 Status Contributor -
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"
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
-
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 -
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