ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro generates new sheet (https://www.excelbanter.com/excel-programming/289398-macro-generates-new-sheet.html)

Bart Van der Donck

Macro generates new sheet
 
Hello,

Suppose that I have an Excel file with 2 sheets.

Sheet "2003" looks like:
ABC|Textvalue|OF|UR|FR
ABC|Textvalue|OF|UR|FR
ABC|Textvalue|OF|UR|FR
DEF|Othertextvalue|CR|UR
DEF|Othertextvalue|CR|UR
GHI|YetOthertextvalue|UI|OO
GHI|YetOthertextvalue|UI|OO
GHI|YetOthertextvalue|UI|OO

Sheet "2004" looks like:
DEF|blabla|CA|UY
DEF|blabla|CA|UY
GHI|blablabla|UT|OL
GHI|blablabla|UT|OL
GHI|blablabla|UT|OL

How can I generate a third sheet that looks like this:
DEF|blabla|CR|UR
DEF|blabla|CR|UR
GHI|blablabla|UT|OL
GHI|blablabla|UT|OL
GHI|blablabla|UT|OL

In other words, all the rows of sheet "2004" should be taken to the
new sheet, but the last two columns of each row (those with
2-character codes) should be taken from sheet "2003". The filter is in
the first column (in this example with codes ABC or DEF or GHI) to
define which rows from sheet "2003" correspond with which rows in
sheet "2004".
Rows that appear in sheet "2003" and not in sheet "2004" should not be
shown in the new sheet. Rows that appear in sheet "2004" and not in
sheet "2003" should be shown in the new sheet exactly as they are in
sheet "2004".

Is this possible in VB / macro / Excel script or so ?

Thank you for suggestions,
Bart


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com