Filtering and copy pasting data to different sheets and save the final sheet as .TXT file

Manish_Gupta

New Member
Joined
Sep 18, 2013
Messages
8
Dear Experts,

I am looking for a Macro which filter the data basis the unique date (month wise) mentioned in one column and copy and paste the filtered data of selected columns to different sheets in same workbook, consolidate and save it as Notepad.

For Example: Below is the data available in Main Sheet

Roll No.EmailAddressMobileDate
101abc@gmail.com*123, Delhi11111111131012022
102abc@gmail.com*345, Gurgaon12345678931012022
103xyz@yahoo.com--28022022
104--12345678928022022
101abc@gmail.com123, Delhi11111111131032022

Steps:
1. Macro need to filter the data basis the unique Date mentioned in Column E.
2. Then copy the all filtered rows (without headers) of Column A and Column C into Sheet1 at Column C and Column D.
3. Then copy the all filtered rows (without headers) of Column A and Column D into Sheet2 at Column C and Column D.
4. Then copy the all filtered rows (without headers) of Column A and Column B into Sheet3 at Column C and Column D.
5. Also, Macro insert the fix values against all the rows in Sheet1 Column A as 01 and Column B as "CBS", in Sheet2 Column A as 02 and Column B as "DBS" and in Sheet3 Column A as 03 and Column B as "EBS"
6. Now the last step is, in Sheet4 Macro consolidate the all Columns data (Column A to Column D) from all 3 sheets (Sheet1, Sheet2 & Sheet3) without headers.
7. In Sheet4, sort the data basis Column A (code mentioned as 01, 02, 03) and Column C (Roll No.) values.
8. Save the Sheet4 data as .txt file through Notepad using Date as file name.
9. Clean all the data from Sheet1, Sheet2, Sheet3 and Sheet4 (do not clean the headers).
10. Perform all 1 to 9 steps again for the next unique date available in Main sheet automatically.

Please note, the number of rows in Main sheet is huge but unique date values are of 2 years.

Apologies for not providing any sample data.

Thanks for your help,
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

Forum statistics

Threads
1,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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