Combobox -> to specific row?

N

NorTor

Hello,

I have a userform with a combobox and some textboxes.
The combobox gets its list from a range of rows in one of the sheets.

The user selects a value in the combobox, and can fill the other
textfields. When the user presses the OK button in the form, I want
the values of the textboxes to be put to specific columns on the row
corresponding to the row that is selected in the combobox.

Please help me how to solve this!

I should also mention that the range is dynamic, so it its resized
with another row (eg from A1:A50 to A1:A51). The problem is to have
values placed in eg B15 and C15 if the user selects the value from
A15 in the combobox.


Hope for help :)
NorTor
 
K

kkknie

Try something like this:

Code
-------------------
Sub CommandButton_Click()

dim r as Range

For Each r in Range("A1:A" & Range("A65536").End(xlUp).Row
If r.Value = Combo1.Text Then
Range("B" & r.Row).Value = Text1.Text
Range("C" & r.Row).Value = Text2.Text
Exit For
End If

Next

End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top