View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Atishoo Atishoo is offline
external usenet poster
 
Posts: 267
Default Lookup and User form

Assuming that you are triggering this with a command button on your user form
and the value is enetered in a combobox on the user form something like this
might work. havent tested this though.
I would be tempeted to name your ranges rather than use ("a:a") though.

Private Sub CommandButton1_Click()
v = userform1.combobox1.value
With Worksheets("Sheet1").Range("a:a")
Set c = .Find(v, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do

With Worksheets("sheet2").Range("a:a")
Set d = .Find("", LookIn:=xlValues)
If Not d Is Nothing Then
firstAddress = d.Address
Do
d.Value = c.value
d.Offset(0, 1).Value = c.offset(0,1).value
d.Offset(0, 2).Value = c.offset(0,2).value

Loop While d Is Nothing

End If
End With
Loop While c Is Nothing

End If
End With
End Sub

This should place your results in the first blank cell in column A in sheet 2.
Tell me how you get on.