LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
RaY RaY is offline
external usenet poster
 
Posts: 164
Default Lookup Data in external workbook

Hello:

I have a worksheet called "PlantAnalysis". Column A has the "Item ID" and I
would like to put the description in column B; starting at cell B3. I am
trying to lookup the Item Description from an external workbook called "Item
master" on worksheet labelled "List". Column A has the "Item ID" and Column C
has the "Description".Is VLookup the recommended way to do this? Below is
what I have but can't get it to work.

Sub getdesc()

'Inserting vlookup statement to populate material description

Dim MyRange As range
Dim LastRow As Long
Dim rng As range
With Sheets("PlantAnalysis")
'find last row in column A
LastRow = sh.range("A" & Rows.Count).End(xlUp).Row
'set range to loop thru
Set MyRange = .range("A3:A" & LastRow)
For Each rng In MyRange
'test if rng is empty, if so skip it
If Not IsEmpty(.Cells(rng.Row, "A")) Then
.cells(rng.row,"B3:B")= Application.vlookup(rng,'C:\[ItemMaster.xls
List'!"$A:$C",3,FALSE)
End If
Next range
End With
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lookup changing data range in external workbook RockCounter Excel Worksheet Functions 5 March 10th 10 08:16 AM
How do i reference an external workbook for data validation? Dex Excel Discussion (Misc queries) 2 October 27th 09 06:13 PM
Reference Data in External Workbook gheimstead Excel Worksheet Functions 0 December 21st 06 02:18 PM
Lookup in data from external datasource Jan Excel Worksheet Functions 1 April 19th 06 01:10 PM
Lookup external data by cell or range of cells Jean[_5_] Excel Programming 2 August 30th 04 10:17 PM


All times are GMT +1. The time now is 08:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"