referencing combobox value to populate lines in textbox with proper entries

Watchdawg

Board Regular
Joined
Jan 21, 2015
Messages
84
I've looked around and I'm having some trouble finding this (probably not wording it right).
I have a list of functions in A5:A50
A list of names spans D3:V3
D5:V50 involves boxes containing "C", "R", or "I" referencing that they have a responsibility in the function in column A

The userform populates from the functions in A, so when that changes, a textbox populates. What I need is the textbox to populate with a list of names (each on a single line) that have the C, R or I designator in the box matching both the name and the function.

Wow, I really hope that came across correctly.
Anyone that can help? Or lead me to a thread that I've missed?
 

Attachments

  • example1.JPG
    example1.JPG
    77.4 KB · Views: 11
  • image_2022-03-21_130749.png
    image_2022-03-21_130749.png
    5.4 KB · Views: 11

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
"referencing combobox value to populate lines in textbox"

You can put here exactly what instruction you use to populate the combo box. I need to look at how you fill the combobox.
 
Upvote 0
I've looked around and I'm having some trouble finding this (probably not wording it right).
I have a list of functions in A5:A50
A list of names spans D3:V3
D5:V50 involves boxes containing "C", "R", or "I" referencing that they have a responsibility in the function in column A

The userform populates from the functions in A, so when that changes, a textbox populates. What I need is the textbox to populate with a list of names (each on a single line) that have the C, R or I designator in the box matching both the name and the function.

Wow, I really hope that came across correctly.
Anyone that can help? Or lead me to a thread that I've missed?

"referencing combobox value to populate lines in textbox"

You can put here exactly what instruction you use to populate the combo box. I need to look at how you fill the combobox.
This populates the description textbox.
VBA Code:
Set xRg = Worksheets("Functional Contacts").Range("A:D")
    
    TextBox1.Text = Application.WorksheetFunction.VLookup(ComboBox1.Value, xRg, 3, False)

In the same sub, I need it to determine if there is any text in the cells to the right of the function, for each cell that has data, I need a seperate line in the second textbox listing the employee name.
 
Upvote 0
I didn't explain myself well. Somehow you are filling the combobox. I want you to put here how you fill the combobox.

Maybe you used AddItem or List or RowSource to fill the combobox, whatever you used to fill the combobox, you should put it here for me to see.
 
Upvote 0
I didn't explain myself well. Somehow you are filling the combobox. I want you to put here how you fill the combobox.

Maybe you used AddItem or List or RowSource to fill the combobox, whatever you used to fill the combobox, you should put it here for me to see.
I use the RowSource. All functions are listed on a hidden sheet and the range is named "Function"
 
Upvote 0
But exactly what the instruction is, put here the complete instruction you use.
 
Upvote 0
But exactly what the instruction is, put here the complete instruction you use.
I understand, but there really isn't any instruction. The coding that I sent earlier is the only VBA in the workbook. If I can figure out how, I paste a cut-down version, but really there isn't any programming going on yet. Only the Userform, combobox populated by the RowSource, then TextBox1 populated by the VBA I sent. TextBox2 is where I'm struggling.
I'm sorry if I'm not understanding what it is your asking for, but this really is all very basic at the moment.
 
Upvote 0
I already understood what you need with the textbox. My doubt is not with the textbox, it is with the combobox, I need to know where the data is on the sheet, but taking the combobox reference.

If I had a combobox and filled it with the rowsource property and asked a question in MrExcel, I would comment: I fill in a combobox with the following statement:

VBA Code:
Private Sub UserForm_Activate()
  ComboBox1.RowSource = "A5:A12"
End Sub
 
Upvote 0
Ok, let's forget that part.

Put the following on your userform:
VBA Code:
Private Sub ComboBox1_Change()
  Dim f As Range
  Dim sh As Worksheet
  Dim i As Long, j As Long, lc As Long
  
  TextBox2.MultiLine = True
  TextBox2.Value = ""

  Set sh = Sheets("Functional Contacts")
  Set f = sh.Range("A:A").Find(ComboBox1.Value, , xlValues, xlWhole, , , False)
  If Not f Is Nothing Then
    i = f.Row
    lc = sh.Cells(i, Columns.Count).End(1).Column
    For j = 4 To lc
      Select Case sh.Cells(i, j).Value
        Case "C", "R", "I"
          TextBox2.Value = TextBox2.Value & vbCr & sh.Cells(3, j)
      End Select
    Next
  End If
End Sub
 
Upvote 0
I already understood what you need with the textbox. My doubt is not with the textbox, it is with the combobox, I need to know where the data is on the sheet, but taking the combobox reference.

If I had a combobox and filled it with the rowsource property and asked a question in MrExcel, I would comment: I fill in a combobox with the following statement:

VBA Code:
Private Sub UserForm_Activate()
  ComboBox1.RowSource = "A5:A12"
End Sub
I'm not understanding, but I think I have this figured out so that you can look at it...example contact list
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

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