Copy data from one sheet to another sheets in the same excel based on date

shansakhi

Active Member
Joined
Apr 5, 2008
Messages
304
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Good Morning.

I require your assistance to build a macro to copy data from one sheet to another sheets in same excel file based on date criteria.


Below is the main file where we have three sets (may be more in actuals) data which we need to segregate to three different sheets based on date criteria.

Below Data is in one sheet. (Please note the column and rows may increase)
[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD]ABCD123[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ORG[/TD]
[TD]Dest[/TD]
[TD]Car[/TD]
[TD]PT[/TD]
[TD]FC[/TD]
[TD]Amount[/TD]
[TD]Eff Date[/TD]
[/TR]
[TR]
[TD]A1[/TD]
[TD]B1[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]PS[/TD]
[TD]412[/TD]
[TD]23-Sep-14[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]KS[/TD]
[TD]442[/TD]
[TD]24-Sep-14[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]LS[/TD]
[TD]482[/TD]
[TD]25-Sep-14[/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ABCD456[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ORG[/TD]
[TD]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like to have three dirfferent sheets ABCD123, ABCD456 and ABCD789 (the names may change).
Then based on Eff Date -- if data is availabe from same day onward then we need to copy the same and paste it to respecting sheets.

Considering 23 Sep 2014 is today ...

The data in output sheets would be as below ...

Sheet1 - ABCD123

[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD]ORG[/TD]
[TD]Dest[/TD]
[TD]Car[/TD]
[TD]PT[/TD]
[TD]FC[/TD]
[TD]Amount[/TD]
[TD]Eff Date[/TD]
[/TR]
[TR]
[TD]A1[/TD]
[TD]B1[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]PS[/TD]
[TD]412[/TD]
[TD]23-Sep-14[/TD]
[/TR]
[TR]
[TD]A2[/TD]
[TD]B2[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]KS[/TD]
[TD]442[/TD]
[TD]24-Sep-14[/TD]
[/TR]
[TR]
[TD]A3[/TD]
[TD]B3[/TD]
[TD]AB[/TD]
[TD]HUB[/TD]
[TD]LS[/TD]
[TD]482[/TD]
[TD]25-Sep-14[/TD]
[/TR]
</TBODY>[/TABLE]


Sheet2-ABCD456

[TABLE="class: grid, width: 500"]
<TBODY>[TR]
[TD]ORG[/TD]
[TD]Dest[/TD]
[TD]Car[/TD]
[TD]PT[/TD]
[TD]FC[/TD]
[TD]Amount[/TD]
[TD]Eff Date[/TD]
[/TR]
[TR]
[TD]A4[/TD]
[TD]B4[/TD]
[TD]BB[/TD]
[TD]BUB[/TD]
[TD]PB[/TD]
[TD]400[/TD]
[TD]24-Sep-14[/TD]
[/TR]
[TR]
[TD]A5[/TD]
[TD]B5[/TD]
[TD]BB[/TD]
[TD]BUB[/TD]
[TD]KB[/TD]
[TD]520[/TD]
[TD]25-Sep-14[/TD]
[/TR]
</TBODY>[/TABLE]


Sheet3-ABCD789

"NO NEW DATA"
(As there is no data available from 23 Sep 14 onward)

Regards,
Shantanu
 

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top