Update sheet based on new import (remove old records and add new)

pluginguin

New Member
Joined
Aug 10, 2016
Messages
21
Office Version
  1. 2019
Platform
  1. Windows
This request has to do with my wish to document which customers need to be emailed about a "late" delivery, which customers were emailed already and when they have to be updated again about the progress of their order.

To achieve this I was tinkering around with an excel spreadsheet, but I am having trouble with updating files.

I have an xlsm-file with 2 sheets. The first (called "Import") contains a link to a csv dat we can refresh whenever there is a new csv. It will then populate the sheet with completely new data.
This data has 4 columns: order date, order number, customer name and order status

The second sheet ("Emails") is supposed to be the sheet where my colleagues can manually add some data to the records.
This data is the same first 4 columns from sheet "Import" but with an additional 3 columns:
  • a column where they document that they have emailed the customer (dropdown)
  • a column with the date of first email (autofilled with vba script on change)
  • a column with the date on which they should update the customer if the order is still late (after 4 days) (autofilled with vba script on change)
Now.... whenever there is a new version of the csv, I want to:
  1. Update the sheet "Import" (already works)
  2. Clear order lines from sheet "Emails" that are no longer present in sheet "Import" (because those orders have been shipped in the mean time)
  3. keep order lines on sheet "Emails" that are still present on sheet "Import" unchanged.
  4. add order lines from sheet "Import" that do not yet exist on sheet "Emails".
I have been recording macro's in which I perform those tasks manually and then trying to translate those to macro's to code that will work every time, but I suspect there should be an easier way to perfom the update.
Can anybody help me out please?
An example set of data on sheet "Emails" could be:
Administratie: 19095 - VehGro B.V.
OrderdateOrder#Customer NameOrder StatusSent mailEmailed onNext email
23-3-2022​
000005615Customer ABCPartially
3-4-2022​
000005804Customer BCD
Partially
8-4-2022​
000005904Customer CDE
Partially
Yes12-05-202216-5-2022
11-4-2022​
000005933Customer DEF
Partially
14-4-2022​
000005990Customer EFGPartially
15-4-2022​
000006005Customer FGHPartially
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Forum statistics

Threads
1,216,108
Messages
6,128,872
Members
449,475
Latest member
Parik11

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