Link to home
Start Free TrialLog in
Avatar of AckeemK
AckeemK

asked on

Macro to compare data between 2 sheets and copy differences over

I am looking to construct a macro that compares two worksheets in a workbook and copy differences over (updates) into one of the sheets that is being compared. Basically, when a file is imported,  the differences need to be copied over into the "Current" tab from the "Import" tab to have the file updated. If it is possible to highlight these differences in the "Import" tab, that would be more beneficial to the user before it is copied over to the "Current" tab.
Report.xlsx
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Few questions...

1. On Basis of which column you want to compare as in the matching key in both the worksheets?
2. Do you want to compare the entire entry or just one particular column or 2 columns.. If just few columns then what are those columns are?
3. If the difference is found.. Do you want to copy or rather update those new entry to current tab from import tab?
Avatar of AckeemK
AckeemK

ASKER

I want to use the ID/SR number column as the unique key to compare between the sheets. I want to compare the entire row against each other and if there are any differences from the imported file within the 'Import' tab then it is updated in the 'Current' tab and the user can see those changes (highlighted possibly) until the file is saved. Most times, everything will remain the same except status, severity and last updated I believe.
ASKER CERTIFIED SOLUTION
Avatar of Saurabh Singh Teotia
Saurabh Singh Teotia
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AckeemK

ASKER

How can I have this macro move any new rows over from the "Import" tab to the "Current" tab if it does not exist there? This will let the user know upon updating their file that a new SR has been added.
You need to add a second layer in the code where you repeat this process again on the import tab to update new SR number in the current tab which essentially be a different macro from the current one since you will be calling that post completion of this macro...
Avatar of AckeemK

ASKER

I am having some issue adding a second layer in the code. The major issue is around having the macro update new SR number in the current tab. Essentially, how do I have a macro be called post completion of another one?
Ackeemk,

Let's say you have two macros in your sheet module with the name of abc and def. Now from abc you want to call second macro def...Then you can simply do something like this...

sub abc
def
end sub

Sub def

End sub

Open in new window