VBA button macro to update database workbook from another workbook

jonobono8888

New Member
Joined
Jan 28, 2019
Messages
14
Hi All

I have a large table in my main database workbook (“Main Database”) - worksheet named "G-XXX Material Database", which contains material codes, material properties, manufacturers, etc (Columns A-L), starting from row 3 (headers are in row 3, all the data is in a filter below that). This table was copied from another workbook (“G-Codes”) in the same folder directory.

Ideally, I’d like an “Update” button macro on my “Main Database” workbook (positioned in Cell C1) which would look at the “G-Codes” workbook table, see if there were any differences and copy and/or replace them over to my “Main Database” workbook (keeping all the same formatting as the “G-Codes” workbook).

For “G-Codes” workbook:
  • The Table is in exactly the same position as in the “Main Database”. I.e. Headers for the table are in row 3, with all the data below it. Number of columns go from A to L. Worksheet name is called “Gxxx Material data base”
  • Additionally – once things have been updated, I’d like the date at which it was updated to be published in cell B1 of “Main Database”, as well as a pop-up message saying that the table was updated successfully. I don’t want anything to happen to the “G-Codes” file at all.

I had a search around for other codes which copies data over from once workbook to another, but I couldn't find anything which checks for consistency and just replaces anything bad. Most duplicating macros just put another row below or paste it in a different sheet elsewhere which I don't want.

If someone could help me with this I'd be super grateful! Thank you! If you need more information, please let me know and I'll try and be as descriptive as possible.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi Jono,
I may be wrong but if you say
"see if there were any differences and copy and/or replace them over to my “Main Database” workbook (keeping all the same formatting as the “G-Codes” workbook)"
This looks just like delete values in Main Database, copy G-Codes all records, and paste values in Main Database to preserve cell formatting
I dont see any difficulty in this, you could even do it with the record macro option
Cheers
Sergio
 
Upvote 0

Forum statistics

Threads
1,224,828
Messages
6,181,209
Members
453,022
Latest member
RobertV1609

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
Back
Top