Thread: Update Sheet1
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob Hick Rob Hick is offline
external usenet poster
 
Posts: 16
Default Update Sheet1

I wouldn't bother using VB - just use a formula to display the result
in a new column next to the original price column, i.e:

Reference Number Description Price/Eur New Price/Eur

In the new column put a formula to lookup the value from sheet2. I'd
suggest the easiest formula would be a VLOOKUP(), e.g. in cell D2 put:

=VLOOKUP(A2,Sheet3!A1:C3,3,FALSE)

(see Excel Help for more about the function)

If the formula doesn't find a match then it will return #N/A, but you
could use the ISNA() function to capture that and put the original
price in its place, or something else, e.g.

=IF(ISNA(VLOOKUP(A2,Sheet3!A1:C3,3,FALSE)),C2,VLOO KUP(A2,Sheet3!A1:C3,3,FALSE))




Steve wrote:
Hello everyone,

I have already made Microsoft Access databases but now I need to make one
small VB program in Excel.
I have 2 Sheets.
In Sheet 1 I have 3 columns like this:

Reference number Description Price/Eur

689023 Socket 2,45
23489 Plug 0,98

There is a lot of reference numbers (cca 8 000).

In Sheet 2 I have table just like this but with different Prices and small
number of
referent numbers (cca 200).

How can I make VB code which will find all Referent numbers from Sheet 2 in
Sheet 1 and put new Price from
Sheet 2 to Sheet 1?

thank you in advance,