Hi,
Hope you can help me!
I'm trying to find a value in a range that matches combobox selection and then adds the value from a row of 3 textboxes to the last empty columns on that row. When I populate the textboxes (lets say I have two rows of dynamically created textboxes), it only takes the data from the last row I entered
Here's the code:
Code
Dim c As Range
Dim strFind As String
Dim lastcol As Long
strFind = ComboBox1.Value
Dim p, j As Long
For p = 1 To number
With ThisWorkbook.Worksheets("xx").Range("A1:A100")
Set c = .Find(what:=strFind, After:=.Cells(.Rows.Count, 1), LookIn:=xlValues, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
lastcol = c.Cells(p, Columns.Count).End(xlToLeft).Column
If Not c Is Nothing Then
c.Offset(0, lastcol).Value = Controls("TB1" & p).Text
c.Offset(0, lastcol + 1).Value = Controls("TB2" & p).Text
c.Offset(0, lastcol + 2).Value = Controls("TB3" & p).Text
End If
End With
Next p
Display More