Update using code

sthack99

Board Regular
Joined
May 16, 2006
Messages
237
I have 2 databases. Both databases contain jobs and information pertained to the jobs. Each job is asigned a job number, and some job numbers contain mutliple lots number. Anyway, here's what I need:

In WB2 there's a column called "final dates". There is also a final dates column in WB1. I need a code that, when you open WB2, will automatically update the final dates for each job based on the info on WB1. Now, I know what you're thinking: "Why don't you just type a formula that says 'the contents of this cell in this WB is equal to the contents of the cell in the other WB'"? I wish it were that easy. Not every job and lot number in one book is in the other. So, the only thing I can think to do is construct a code that will look at the first job number in WB2, go to WB1, find that same job number (if it exists), do the same for the lot number (if one exists), grab the date, and insert it in WB2. Have I lost you yet? Here's how the columns look (in both WBs):

Job Number.......Lot Number.......Final Date
1000.................1......................6/25/2007
1000.................2......................5/28/2007
1000.................3
1025.................N/A..................12/12/2006
1032.................52
1032.................54....................1/2/2007
1033.................N/A...................3/20/2007
1041.................1
1041.................2......................4/21/2007

As you can see, there's not much consistancy, except the job numbers are in order. And also, as you can see, lot numbers can repeat. You just can't have the same lot number printed twice for the same job.

So what do you recommend I do about this?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,181,420
Messages
5,929,801
Members
436,696
Latest member
Mr Rice

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top