|
-
May 22nd, 2015, 03:58 AM
#1
Thread Starter
New Member
userform - combobox & texbox
hi
I have a problem and I don't know how to solve it.
I have a userform with 15 comboboxes and 15 textboxes.
combobox1 refer to textbox1, the combobox2 refer to textbox2 etc.
i.e
sub load_data_to_combobox()
.
.
.
With UserForm1.ComboBox1
.ColumnCount = 4
.ColumnWidths = "0;1in;1in;;;"
.TextColumn = 4 'the first column is the ID, the second is the name the third is the price
.AddItem Sheets("sh1").Range("a2:d" & y).Cells(i - 1, 1).Value
End With
.
.
.
end sub
Private Sub ComboBox1_Change()
.
.
.
.
userform1.textbox1.value=???
.
.
.
.
end sub
question1: Is it possible to take the value from the third column of the combobox directly to textbox? I'm using the vlookup from the sheet that contains the data.
question2: The same function load_data_to_combobox I have to repeat for all 15 comboboxes. Is any possibility to use the function "for .. to... next" or "loop" or anything else
something like this
for i =1 to 15
With UserForm1.ComboBox & i ' I tried this but is not working
.ColumnCount = 4
.ColumnWidths = "0;1in;1in;;;"
.TextColumn = 4 'the first column is the ID, the second is the name the third is the price
.AddItem Sheets("sh1").Range("a2:d" & y).Cells(i - 1, 1).Value
End With
next i
thanks for your help
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|