Hello,
On my spreadsheet I have a column with "Test No."
I have a button that brings up a userform which allows me to input my test no which then populates the userform with the data from the spreadsheet for that particular test no.
At the moment it only allows me to lookup Numbers in my Test number textbox on the userform. i need to change:
"If IsNumeric(RTMotherRoll_Search_UserForm.TextBox1.Value) Then"
to allow me to include text.
On my spreadsheet I have a column with "Test No."
I have a button that brings up a userform which allows me to input my test no which then populates the userform with the data from the spreadsheet for that particular test no.
At the moment it only allows me to lookup Numbers in my Test number textbox on the userform. i need to change:
"If IsNumeric(RTMotherRoll_Search_UserForm.TextBox1.Value) Then"
to allow me to include text.
Code:
Dim id As Integer, i As Integer, j As Integer, flag As Boolean
Sub RTMotherRollGetData() 'Change to same name within userform
If IsNumeric(RTMotherRoll_Search_UserForm.TextBox1.Value) Then 'Change to same userform name
flag = True
i = 5 'start at row
id = RTMotherRoll_Search_UserForm.TextBox1.Value 'Change to same userform name
Do While Cells(i + 1, 2).Value <> "" 'starting cell, means (row+1, col)
If Cells(i + 1, 2).Value = id Then 'starting cell, means (row+1, col)
flag = True
For j = 2 To 72 'Change to how many boxes on userform
RTMotherRoll_Search_UserForm.Controls("TextBox" & j).Value = Cells(i + 1, j).Value 'Change to same userform name
Next j
End If
i = i + 1
Loop
If flag = False Then
For j = 2 To 72 'Change to how many boxes on userform
RTMotherRoll_Search_UserForm.Controls("TextBox" & j).Value = "" 'Change to same userform name
Next j
End If
Else
RTMotherRollClearForm 'Change to same name Below
End If
End Sub