View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default Rather tired and need solution please 4 Vllookup :-D

Perhaps this will help. Put this macro in WorkbookA. Change the worksheet
and workbook names as needed.

Sub test()
Dim rngCell As Range
Dim rngFound As Range
Dim rngA As Range
Dim rngB As Range

With ThisWorkbook.Sheets("Sheet1") '<<<CHANGE
Set rngA = .Range("A1:A" & _
.Cells(.Rows.Count, 1).End(xlUp).Row)
End With

With Workbooks("WorkbookB.xls").Sheets("Sheet1") '<<CHANGE
Set rngB = .Range("A1:A" & _
.Cells(.Rows.Count, 1).End(xlUp).Row)
End With

For Each rngCell In rngA
If Len(rngCell.Value) 0 Then
Set rngFound = rngB.Find( _
what:=rngCell.Value, _
after:=rngB.Range("A1"), _
LookIn:=xlValues, _
lookat:=xlWhole, _
searchorder:=xlByColumns, _
searchdirection:=xlNext, _
MatchCase:=False, _
matchbyte:=False)

If Not rngFound Is Nothing Then
rngCell(1, 39).Value = rngFound(1, 7).Value
Set rngFound = Nothing
End If
End If
Next rngCell

End Sub



"Les Stout" wrote:

Thanks JMB but i need to do this with code, automatically...

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***