• 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 Copy Worksheet & Format

DEL

New Member
Hi,

I am not long using VBA and have only written some small bits of code to date, but have been tasked with reducing time formatting to get desired format.

I have a weekly source file, which contains customers and billing qtys & values and a number of other columns not relevant to me.
The worksheet has the same amount of columns but amount of rows may differ weekly, anywhere from 40 -150 rows.
I want to write some code to allow me to copy this source worksheet & paste special the values into another sheet eg Sheet2
On this Sheet2, I then want to delete the columns not coloured orange as I don't need these and then sort the data remaining by the Column 17.
Then where the customer changes in Col 17, I want to cut this data & paste onto a new worksheet for each customer - usually only 5 customers, so I will have 5 new worksheets one for each customer in file.
Having done this for each worksheet, I then need to subtotal the values column 12 on each sheet by column 2
I have made some attempts but without any success - final attempt is on file, any help would be greatly appreciated

I have not used google share before pls let me know if it is visible,

https://docs.google.com/spreadsheets/d/1McO8yjtT3H3cb_vzz6jASzW7mCSzjHknlcTMOeKNpBI/edit?usp=sharing
 
When you say 'delete columns not coloured orange' I assume you mean the specific columns rather than for macro to identify the colour & then delete the column?
 
Thks chirayu, it works great, if possible could I put a subtotal of col12 for each change in col 2 on each new sheet
 
Hi,
Re worksheet above,
The macro already subtotals col F but I would like to add subtotal to other cols but not sure how to go about this, also the subtotals for some lines with only 1 figure are including the subtotal above - how do I change this? Thks
 
I modified to subtotal other columns. But can't seem to see where it subtotal above a row. not having same issue so you'll need to provide data that replicates that issue so I can check
 

Attachments

  • Worksheet & Format.xlsm
    24.5 KB · Views: 8
Thks chirayu,
When I run the macro, on sheet 3 ( 1st sheet created by macro) I am getting the below screenshot, I would expect to see €1,000 for both cells in red but it seems to be adding the subtotal of line above, this appears to only happen when one line entry on all sheets

upload_2015-10-13_15-21-39.png
 
Back
Top