Using a drop down in userforms and need vlookup to return a value from worksheet

land144

New Member
Joined
May 25, 2021
Messages
9
Office Version
  1. 2019
I have a pretty detailed userform with lots of choices on it but I need help with two things, I've put a picture of my user form to make it easier for me to explain. I have a worksheet called students, the first row is name and the next 3 rows are numbers (exam results) I want to be able to select the student in the names drop down and then the three text boxes to the right of that display the numbers from the worksheet "students". Is this possible? I found this code on this forum and renamed it but it just created an error:

Private Sub TextBox3_Change()
TextBox3.Value = var1
var1 = WorksheetFunction.VLookup(ComboBox7.Value, Worksheets("Students").Range("Names"), 2, False)



My second question is on the right hand side, I wanted a bigger "preview pane" type textbox that displays the full text from each of the drop downs on the left depending on which one is selected (so I can word wrap them because some of them are really long)

I know how to use TextBox1.Text = ComboBox2.Text but how do I make it delete and then fill up the text box with the next combo box and then delete each time?

End Sub
help.jpg
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

Forum statistics

Threads
1,212,927
Messages
6,110,718
Members
448,294
Latest member
jmjmjmjmjmjm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top