chroniclesofdave
New Member
- Joined
- Aug 8, 2016
- Messages
- 48
I have the following code from a previous project i worked on and tried to modify it to find the value of a cell in column A and if the value matches, then display the two adjacent cell values in the two textboxes i have on the user form:
The value is being pulled from combobox2 and the textboxes that should be receiving the data are TextBox723 and TextBox724.
While the above code does not throw any errors, the data is not displaying on my userform. Any ideas?
Edit: The values of Combobox2 are coming from Sheet3 column A, and the two adjacent columns, B and C and what I am trying to have it pull and display.
VBA Code:
Dim i As Integer
Dim arrIn As Variant
Dim arrOut()
Dim j As Long
Dim counter As Long
Dim outRow As Long
Dim sUser As String
sUser = LCase(ComboBox2.Value)
With Sheets("Sheet3").Range("A1").CurrentRegion
arrIn = .Value
counter = Application.CountIf(.Columns(2), sUser)
For i = 1 To UBound(arrIn)
If VBA.LCase$(arrIn(i, 2)) = sUser Then
For j = 1 To UBound(arrIn, 2) - 1
outRow = outRow + 1
Me.Controls("textbox" & outRow) = arrIn(i, j)
Next j
End If
Next i
End With
While the above code does not throw any errors, the data is not displaying on my userform. Any ideas?
Edit: The values of Combobox2 are coming from Sheet3 column A, and the two adjacent columns, B and C and what I am trying to have it pull and display.