View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bart Van der Donck Bart Van der Donck is offline
external usenet poster
 
Posts: 2
Default Macro generates new sheet

Hello,

[[[------There was en error in my previous post some minutes
ago------]]]
[[[------This is the corrected post------]]]

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|UI|OO
GHI|blablabla|UI|OO
GHI|blablabla|UI|OO

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