matching and finding data

L

Lynn

hi,

how do i match columnA in spreadsheetA with columnB in spreadsheetB to
find the value in columnD of spreadsheetB ?
 
J

Joel

this code put the results in column B of spreadsheetA

set shtA = sheets("spreadsheetA")
set shtB = sheets("spreadsheetB")
RowCount = 1
with ShtA
Do while .range("A" & Rowcount) <> ""
Data = .range("A" & Rowcount)
Set c = ShtB.Columns("B").find(What:=Data, _
lookin:=xlvalues, lookat:=xlwhole)
if not c is nothing then
.Range("B" & RowCount) = c.offset(0,2)
end if

RowCount = RowCount + 1
loop

end with
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top