I have an userform that searches the row by name. But I need one textbox showing the data in column AD of that row in that textbox to be changed. How do I accomplish that?
I enclose the code here:
I'd be grateful for any hints
I enclose the code here:
Code:
<< This finds the names & shows them in the list box >>
Private Sub UserForm_Activate()
Dim MyList(200, 1), M%, N%
Dim Cell As Range
Dim Top As Range
Dim Bottom As Range
Dim MyRange As Range
PrintButton.Enabled = False
With ListBox1
.ColumnCount = 1
.ColumnWidths = "60pt" ';35pt;35pt;35pt"
.Width = 182
.Height = 200
.BoundColumn = 1
.ControlTipText = "Double-Click name to add to Print list"
End With
DoEvents '< allows time for the userform to load
Application.ScreenUpdating = False
Sheets("Lista1").Activate
M = 0
Set Top = Range("Z2")
Set Bottom = Range("Z65536").End(xlUp).Offset(1, 0)
Set MyRange = Range(Top, Bottom)
For Each Cell In MyRange
If Cell Like "*" & NameToFind & "*" Then
MyList(M, 0) = Cell
M = M + 1
End If
Next Cell
ListBox1.List = MyList()
DoEvents '< allows time for the userform to update
Sheets("Etsi").Activate
End Sub
I'd be grateful for any hints