Userform : automatically fill multiple textboxes based on a selection combobox

patate

New Member
Joined
May 9, 2014
Messages
5
Hello everyone,
I am currently learning VBA and I am trying to do an userform for my internship.
I made one and what I am trying to do is to fill multiple textboxes based on my combobox.

qP7eOia.png


5ks5iPG.png


If I choose the game Fifa 12, I would like the textboxes filled based on my previously excel worksheet (with the help of some lookup maybe). The result should be like this (I typed manually in the textbox to show you):

3LSRMPT.png


I tried to search and I don't know if it is possible to do so, I found a code on the forum that I tried to do it but unfortunately it only fills the first value of the excel sheet:

Code:
Private Sub cboConsol_Change()
  txtNintendoSales.Value = FindName(cboGames.Value)
  txtSonySales.Value = FindName(cboGames.Value)
  txtMicrosoftSales.Value = FindName(cboGames.Value)
  txtNintendoConsole.Value = FindName(cboGames.Value)
  txtSonyConsole.Value = FindName(cboGames.Value)
  txtMicrosoftConsole.Value = FindName(cboGames.Value)
End Sub

Public Function FindName(Games) As String
With Worksheets("subscriptions").Range("B:B")
Set C = .Find(Games, LookIn:=xlValues, lookat:=xlWhole)
If Not C Is Nothing Then
FindName = C.Offset(0, 2).Value
Else
FindName = "Not Found"
End If
End With
End Function

I also found a FormulaArray but I didn't quite understand.

Thank you in advance for your help and I hope you will understand what I am trying to do.
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,215,650
Messages
6,126,012
Members
449,280
Latest member
Miahr

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