Mabes
New Member
Hello all,
I have been tinkering with this code for a bit and cannot seem to get it to work. I have a table that stores a lot of info on each row. We access that based on the unique number in the first column - I have created a user form to make it simpler for my staff to retrieve that info. The only problem is that when I select one of the unique numbers - none of the other boxes populates. The key is that once a selection is made in the TrComboBox I want the text boxes to pull the appropriate data from my table. Can anyone help me out?
I have been tinkering with this code for a bit and cannot seem to get it to work. I have a table that stores a lot of info on each row. We access that based on the unique number in the first column - I have created a user form to make it simpler for my staff to retrieve that info. The only problem is that when I select one of the unique numbers - none of the other boxes populates. The key is that once a selection is made in the TrComboBox I want the text boxes to pull the appropriate data from my table. Can anyone help me out?
Code:
Private Sub TrComboBox_AfterUpdate()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("MAIN PROFILE")
wsLR = ws.Cells(Rows.Count, 1).End(xlUp).Row
For x = 2 To wsLR
If ws.Cells(x, 1) = TrComboBox.Value Then
Me.SysNoTextBox = ws.Cells(x, 9)
Me.TrAddressTextBox = ws.Cells(x, 3)
Me.CityTextBox = ws.Cells(x, 4)
Me.ProvTextBox = ws.Cells(x, 5)
Me.ABMIDTextBox = ws.Cells(x, 13)
Exit Sub
End If
Next x
End Sub
Last edited by a moderator: