• 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.

Sheet creation based on Cell Value and copy data to the new sheets

Hello,

I am trying to create Sheets based on the K columns values (Except Header) and paste the respective values from the Sheet Data.

For Example The K column has the value "Older" and Once Sheet created, all the Rows which fall under "Older should move to the newly created sheet (Sheet name should be K column value).

The Macro file attached herewith. The code used in the file shows error as it creates sheets but it continuous even after the required sheets creation (run time error: 1004).
 

Attachments

  • Test-macro.xlsm
    150.6 KB · Views: 6
For starters, you do not refer to the correct sheet at the beginning of the macro. If you'd call the macro from Sheet1, since K2 is empty, you iterate trough empty values and try to create a sheet name ""?
Also your data has 43 repeated header rows. You should clean it up first.
Best to generate a unique list of values from K as use this range a parameter to generate new sheets and filter data to copy.

alternative to macro , make a flat pivot (tabular form, without any sub or grand totals) and run "show report filter pages".
upload_2018-3-19_11-46-10.png
 

Attachments

  • Test-macro.xlsm
    326.9 KB · Views: 1
Niranjanrajrishi
.. or You could test to press [ Do It ]-button
... there are some data, but ... this would MOVE all of those
( If COPY then 'hide' one row from code )
 

Attachments

  • Test-macro.xlsb
    50 KB · Views: 3
Niranjanrajrishi
.. or You could test to press [ Do It ]-button
... there are some data, but ... this would MOVE all of those
( If COPY then 'hide' one row from code )
For starters, you do not refer to the correct sheet at the beginning of the macro. If you'd call the macro from Sheet1, since K2 is empty, you iterate trough empty values and try to create a sheet name ""?
Also your data has 43 repeated header rows. You should clean it up first.
Best to generate a unique list of values from K as use this range a parameter to generate new sheets and filter data to copy.

alternative to macro , make a flat pivot (tabular form, without any sub or grand totals) and run "show report filter pages".
View attachment 50873
Thank you so much! It works like a charm!
 
Back
Top