New Member
November 15, 2023
Good Morning/Afternoon everyone,
Hopefully someone can help me out with a VBA Macro i am having a hard time solving...Basically i have an excel that has Name, Age, Gender, City , and State in colums. I already created a userform with the following labels and textboxes but the problem im having is i am trying to make it where i create a commanbutton ( Search and Display) , input characters that are part of their last name and have it display in the textboxes according to their category. Basically for example if i type Smith or smith it will be able to identify the information and display it the other data into the text boxes or if members have same last names i can just put Smith, D as a search option. any guidance will be greatly appreciated.
This is what i have so Far:
Dim Name As String
Name = Trim(TextBox6.Text)
lastrow = Worksheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
If Worksheets("Sheet1").Cells(i, 1).Value = Name Then
TextBox1.Text = Worksheets("Sheet1").Cells(i, 1).Value
TextBox2.Text = Worksheets("Sheet1").Cells(i, 2).Value
TextBox3.Text = Worksheets("Sheet1").Cells(i, 3).Value
TextBox4.Text = Worksheets("Sheet1").Cells(i, 4).Value
TextBox5.Text = Worksheets("Sheet1").Cells(i, 5).Value
1 Guest(s)