Thread: vlookup
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default vlookup

Patrick,

You can never have too many superfluous variables :-)

Bob


"Patrick Molloy" wrote in message
...
Private Sub ListBox1_Click()
TextBox1.Text = ListBox1.Value
End Sub


;)

"Bob Phillips" wrote in message
...
Simpler

Private Sub ListBox1_Click()
Dim i As Integer
TextBox1.Text = ListBox1.Value
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"William" wrote in message
...
Hi Patrick

If I have understood you correctly, try....

Private Sub ListBox1_Click()
Dim i As Integer
TextBox1 = ""
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) Then
TextBox1 = ListBox1.List(i)
Exit Sub
End If
Next i
End Sub


--

XL2003
Regards

William



"Patrick Simonds" wrote in message
...
Would it be possible to use a variable returned by a ListBox, on a
UserForm, to place a value in a TextBox on the same UserForm? Maybe

on
a
ListBoxClick routine.