Hello guys! I'm new to the forum and I have been learning a lot having troubles in VBA, as I know nothing about it
That said, hope someone can help me with three things:
I have figure it out how to populate a ComboBox and based on that selection populate several textboxes with some names. And after entering some other data I have a save button to send all those values to a table.
But, I need those autopopulated texboxes with names, to show a value that matches that name in a table. I have tried a vlookup after the change in the combobox and also after the change in a name textbox but it does not bring the value.
So, in the table named Tabla2 where the records are saved I have:
Column 1 Name Column 3 Column 4 Column 5 Column 6 Column 7 Column 8
Row 1 x John x x 123 x x x
Row2
If an user made a previous record and save a number that is stored in column 5, the next user that make a new record can see if that name has a record and displays it. Meaning I need to auto Populate a Texbox based on another auto populated textbox.
To populate comboBox I have data in a Table named Bds
Private Sub UserForm_Initialize()
Dim cLoc As Range
Dim ws As Worksheet
Set ws = Worksheets("Bds")
For Each cLoc In ws.Range("categorias")
With Me.ComboBox2
.AddItem cLoc.Value
End With
Next cLoc
End Sub
To autopopulate the name textboxes I have:
Dim ws As Worksheet
Dim rng As Range
Dim Sel
Set ws = Sheets("Bds")
Sel = Me.ComboBox2.Value
If Sel <> "" Then
Set rng = ws.Columns(1).Find(Sel, Lookat:=xlWhole)
If Not rng Is Nothing Then
Me.Reg5.Value = ws.Cells(rng.Row, "B")
Now I need the textbox T5 to show a value that matches the auto populated Reg5. Vlookup is not working for me I do not know why. :/ Any ideas?
Thank you so much for your help!!
Sergio.
Bookmarks