Dynamic copy and paste to new workbook

Tixuk

New Member
Joined
Jun 16, 2011
Messages
1
Hi all,
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p></o:p>
Hope someone can help with this one. I have a spreadsheet that’s been created using a number of VB scripts (unfortunately I can't seem to upload a pic or spreadsheet, if someone can tell me how I'll gladly post an example!) The issue is this - column A contains a blank cell in A1, then data in cells B1, C1, D1 and E1. Rows 2-11 contain data in all cells from A2-E11. Cell A12 is then blank - so effectively each blank cell represents a new ‘section’ of data. What I would like to happen is for the script to copy each ‘section’ of data to a new workbook, and then rename that workbook to the value in cell A2 of each workbook, minus the “#1” (i.e. everything in cell A2 without the ‘#’ sign and number). So in this example, the first workbook would be called “Fans.xlsx” and would contain rows 1-11, the second would be “Power Supply.xlsx” and would contain rows 12-17, the third would be “Onboard Administrator Network” and would contain rows 21-23 and so on.

The tricky bit (for me at least!) is that today there may be 10 fans, but tomorrow there may only be 5, so the script needs to be dynamic when searching for the blank cells – the number of columns of data may also vary as well.
<o:p></o:p>
<o:p></o:p>
As a final part to the script, I would like it to add an additional column at the end of each new workbook called “Asset Type”, ideally the cells in this column will have the same value as the string we used to create the filename, so again, using the example given, our first “Fans.xlsx” book will contain 10 fans, each having an “Asset Type” of “Fan”, the second book will contain 5 power supply’s, each having an “Asset Type” of “Power Supply”.
<o:p></o:p>
<o:p></o:p>
I hope this all makes sense, hopefully some genius out there can help me out with this one! As I say, I'll gladly post or send an example file as I think it's a bit tricky to understand from my ramblings!! Any advice or help would be much appreciated,
<o:p></o:p>
<o:p></o:p>
Best Regards,
<o:p></o:p>
<o:p></o:p>
Tixuk<o:p></o:p>
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

Forum statistics

Threads
1,224,518
Messages
6,179,254
Members
452,900
Latest member
LisaGo

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