PDA

View Full Version : Problem: Compare two excel files and mark new text.



Kareltje
10-25-2018, 07:43 AM
Hi all,

I have a complicated task and after a few days of trying, I am not able to find a solution but to be honist, I am a beginner in VBA so that does not help.

Goal:
Compare two worksheets (of which one is a updated version than the other) and mark the new text in a certain colour. While keeping the colours of the orgininal file.
For example. Cell X in worksheet 1 is: "blablanowtest" and Cell X in worksheet 2 is "blarwvblantestextra". I want Cell X in worksheet 2 to become "blarwvblantestextra"
So the colours of the letters that stay have to stay the same, but added letters should get a new colour.

Context:
I am a student and I am doing an internship for a company. I am not very experienced with programming so every bit of help is welcome. The situation for the programm is:
On a website, we put all data in. But sometimes we need that data in an excel file. I have made a macro that extracts the data and writes it in a template. That works oke.
Now, If the data is updated on the website. We can make an updated excel file by using the macro again. Now the goal is to have the new information in another colour. So it is clear what is new. And in the best way possible, a third, fourth and fifth update is possible with keeping the original colours so that in the and the colours can be used to to see what is changed over time. For example.

Cell: Text 1 blablabledsa, Thispart is added after the first update. This part is added after the third update.

but also, when something is deleted it stays deleted. Like shown below



Version x
Version version x+1
goal


Ihopethis
Ihopethismakes
Ihopethismakes


italittle
ita
ita


clear
moreclear
moreclear




I have been working on only the code to compare two cells for two days now, but I can not find a way to do it. I have found ways that marks everything and than makes black what is similar. But that is not what I want because I want to keep the colours.

I hope someone can help me.