View Full Version : need to make an excel macro that updates prices from another worksheet

07-15-2010, 01:10 AM
Ok I have a pricelist that updates our engine parts list for MYOB via the internet using a macro, this price list contains 28,331 individual parts.
I also have a mysql database of a select 713 of these parts (these are the most common parts that we want to catalogue on our website).
What I would like to do is have a macro update the prices of these 713 parts from the worksheet containing the 28,331 parts using the item number as an identifier.

For example, I think the code needs to take these steps:

1. Look at worksheet 'mysql' , cell 'E1' (Column E being the item number column on the mysql worksheet containing the 713 parts).

2. Store the contents of that cell in a variable (for argument sakes lets call this variable 'N').

3. Search worksheet 'updated' , column 'A' (Column A being the item number column on the updated price list for MYOB containing the full 28,331 parts) for variable 'N'.

4. On whichever row this is found I need it to look at column 'C' (Column C being the price column).

5. Store the contents of that cell in another variable (lets call this variable 'P').

6. On worksheet 'mysql' replace row '1' column 'F' (Column F being the price column) with the price in stored variable 'P'.

7. Repeat these steps for the next row and so forth until all 713 parts on the list have been updated.

I know that is probably not how an excel macro even operates, I have never worked with them before but its the way I found easiest to explain step by step what I require the macro to accomplish.

I would really appreciate any help, thanks.