Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Update Sheet1

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,


  #2   Report Post  
Posted to microsoft.public.excel.programming
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,


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Update Sheet1

Thank you Rob,

problem is that I do not have space for another column in Sheet 1, can I
with this function replace old Price
with new one from Sheet 2 and is there a way to change colour of cell which
has changed Price?

thank you in advance,


"Rob Hick" wrote in message
oups.com...
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,




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Update Sheet1

No, you need to put the function in a new cell because it needs to
reference both the old price and the new price. It seems strange that
you have no room on Sheet1 - you could always insert a new column if
the current one has some data in. Failing that you will have to insert
a new sheet and put references to the original cells on Sheet1.

You can colour code those cells that have changed by using 'conditional
formatting' from the Format menu. It's a bit difficult to explain
exactly what to do in this post but if you have a look in Excel Help,
there is a fairly comprehensive guide.

Rob


Steve wrote:
Thank you Rob,

problem is that I do not have space for another column in Sheet 1, can I
with this function replace old Price
with new one from Sheet 2 and is there a way to change colour of cell which
has changed Price?

thank you in advance,


"Rob Hick" wrote in message
oups.com...
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,



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Update Sheet1

Hello Rob,

thank you for your advice, it works.It works in a way that all references in
Sheet 2 must be in sort order just
like references in Sheet 1.I have tried to put one reference number and
changed it price in Sheet 2 but on different place
then in Sheet 1 and it does not work.Can I make additional code which will
search only references in Sheet 1 which I have chosen in Sheet 2
and in sort order I want?

thank you in advance,






"Rob Hick" wrote in message
ps.com...
No, you need to put the function in a new cell because it needs to
reference both the old price and the new price. It seems strange that
you have no room on Sheet1 - you could always insert a new column if
the current one has some data in. Failing that you will have to insert
a new sheet and put references to the original cells on Sheet1.

You can colour code those cells that have changed by using 'conditional
formatting' from the Format menu. It's a bit difficult to explain
exactly what to do in this post but if you have a look in Excel Help,
there is a fairly comprehensive guide.

Rob


Steve wrote:
Thank you Rob,

problem is that I do not have space for another column in Sheet 1, can I
with this function replace old Price
with new one from Sheet 2 and is there a way to change colour of cell
which
has changed Price?

thank you in advance,


"Rob Hick" wrote in message
oups.com...
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,




Reply
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
Compare and Update elements from Sheet1 with Sheet2 [email protected] New Users to Excel 3 November 27th 07 04:27 PM
[=Sheet1!A1] - if i use Column A1 ('Sheet1') / A2 ('Sheet2') Lawrence C H Tan Excel Worksheet Functions 0 January 19th 07 08:29 PM
Sheet1.Activate vs Sheet1.Select mikeburg[_46_] Excel Programming 4 October 11th 05 04:30 PM
how to update data on sheet1 and have it auto update on sheet2 Tommy Excel Programming 6 May 11th 05 06:41 PM
Why Sheet1 is displayed in modules as sheet1 Jim at Eagle Excel Programming 2 April 22nd 05 03:09 PM


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

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

About Us

"It's about Microsoft Excel"