Link to home
Start Free TrialLog in
Avatar of Luis Diaz
Luis DiazFlag for Colombia

asked on

VBA: compare column rows by rows based on a config sheet v3

Hello experts,

I have the following procedure reported at the following at:
https://www.experts-exchange.com/questions/28997130/VBA-Compare-columns-row-by-row-based-config-sheet-v2.html#a41982797

Open in new window


 which I used to compare two columns rows by rows based on a config sheet.

User generated image
I would like to make some little changes:

1-Instead of applying in the reference worksheet and in the output worksheet the compare columns actions (highlight values of columns to compare and adding new column),
I would like that the procedure copy the reference worksheet (in order to keep it with the original version no formatting applied and not adding any column) rename the reference worksheet already copied with the output worksheet and applying the various actions just in the output worksheet.
2-If the output worksheet already exist it should be remove it before applying the procedure in order to have a reset of new version of output worksheet.

If you have questions, please contact.

I attached dummy file.

Thank you very much for your help.
Compare_columns_row_by_row_based_co.xlsm
Avatar of Shums Faruk
Shums Faruk
Flag of India image

Added Ms-Excel in your topic, so other experts can also help you.
What should happen if column G:J is empty, like the picture for Sheet3.
Then there is no sheet to copy to, and do the formatting on.

Column G and I has no meaning when the entire sheet is copied to Output sheet.
Avatar of Luis Diaz

ASKER

In that case the line should be omit as all the required information is not filled in the config sheet.
An initial condition verification can be done in the checkconfig such as if one of the lines from Column A to J is blank exit the line as all the required information is not properly filled.
Check attached.
Output sheet is added after Report sheet.
If checkconfig fail, then config sheet columns E and F will be "Omit".
Compare_columns_row_by_row_based_co.xlsm
Thank you very much for this proposal. I don't have access right now to my pc. I will take the time to test it.
Thank you very much for this proposal.

I tested and it works fine.

However I was wondering if we can keep the flag in the function
Flag=2 retain all the values related to true
Flag=1 retain all the values related to false
Else retain true and false.


Last request, I was wondering if you know a procedure or a function to call in order to group columns
Example I report in the config Sheet B:C the procedure should apply a group from B:C
User generated image
I attached dummy file with your last proposal and the GroupRange in the config.

Thank you very much for your help.
Compare_columns_row_by_row_based_co.xlsm
See attached.

Reference range has no function.
Compare_columns_row_by_row_based_co.xlsm
Thank you very much for your proposal.

I tested and it works.

Just a remark flag=3 in order to retain True and False in OutputSheet hasn't been added. Is it possible to added it.

I send you the last version with my test.

Thank you again for your help.
Compare_columns_row_by_row_based_co.xlsm
ASKER CERTIFIED SOLUTION
Avatar of Ejgil Hedegaard
Ejgil Hedegaard
Flag of Denmark 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
It works perfectly!!Thank you again for your help.