• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to create mutiple worksheets from Masterworksheet based on a column

MGJoe

New Member
Can someone VBA nerd from Excel Help Forum crate a VBA code to do the following:
Introduce a new column N captioned WP and the end and extract the first four characters from column I (Issued to Package) and enter the extracted text (or number?) in the new column N.
I have just done that using the formula =mid(celladress,1,4)
You now have 17 different WPs; 7000, 6330, 6500, etc.
I now want create multiple worksheets based on the WPs in column N; to have 17 additional worksheets added to the workbook.
I want the new worksheets named by WP nos. 7000, 6330........ and placed in order.
Then delete the newly created column if possible from the master sheet
I want to have the exact formatting/custom sort order as the master worksheet.
The number of columns in the master are same but the number of rows vary every day.
The attached sheet has 301 rows including the title, but the next report will have different number of row, may increase or decrease.
Sample worksheet attached.
Help much appreciated. Thanks in advance. I am now doing this manually which tkes too long. And if the rows increase to 10,000.......?
 

Attachments

  • Master Worksheet.xlsx
    58.9 KB · Views: 9
Hi Dear,

You need not macro but pivot table. Find attached your workbook and tell me if you required the same.

Insert Pivot Table, Put all items in row labels. go in to Pivot table tools> design > Report Layout > Show in tabular form
Grand Total > Off rows and columns
Subtotals > Do Not Show Subtotals

then put your WP which you generated by yourself in filter.

then go to Pivot Table Tools > Analyze > Options > Show Report Filter Pages > Click on OK buzz you will get what you are looking for.

Best Wishes
Shakeel
 

Attachments

  • Master Worksheet.xlsx
    213.7 KB · Views: 5
Thanks. It is simple and fast. Unforunately, it does not mainn the format and custom sort order as per the master sheet.
The master shhet has neen sorted by Level>Zone>Location.
 
Please see attached macro I got from internet. Can this be modified to solve my query?
 

Attachments

  • Advanced Filter Report.xlsm
    21 KB · Views: 1
I am not expert in VBA so i can give you solution via pivot.

To maintain sorting, you should add Sr. No and put at start in Pivot like i do in your data please check attached.

And for formatting you need to select all sheets and go on Master sheet repeat all formatting in comments where blank is written press space....it will take only one minute for all process.

Check now. If it is ok, i will make manual macro for you.
 

Attachments

  • Master Worksheet.xlsx
    93.3 KB · Views: 2
Attached is Macro, you have to open your master sheet and also open my macro sheet, add Sr. No (same words) in your master sheet in Column A, insert pivot table after selecting all of your data, make sure pivot table name should be PivotTable1

ok than press ctrl u


than come on master sheet add two rows at start

now select all sheets

press ctrl i

than press ctrl o

i hope it will work

Best Wishes
Shakeel
 

Attachments

  • Master Worksheet Macro by Shakeel.xlsm
    23.5 KB · Views: 6
The completed Master Worksheet you sent me is 100% perfect.
My only problem is understanding the steps involved and get it right.
I will try my best and come back to you if I have problems.
Thanks for your time and concern.
 
Back
Top