PDA

View Full Version : Comparing 2 sheets



Conor
11-25-2007, 11:13 AM
Hi Guys,
I have two spreadsheets. Sheet1 contains a part code in column D. Sheet2 contains the partcodes in column A and the value of the part in column B. I need to update sheet1 with the values regulary. So far i have been using multiple if and for loops instead of referencing the data in sheet2.
eg

For Each rCell In Range("D1:D300")
If UCase(rCell) = "167856" Then
rCell.Offset(0, 1) = "27"
End If
Next rCell

where 167856 is a partcode and 27 is the value

However the amount of partcodes have now tripled and i need a macro to do this for me automatically as sheet2 will be expanding in the future

JimmyTheHand
11-25-2007, 12:56 PM
Have you tried VLOOKUP function?

Jimmy