PC Review


Reply
Thread Tools Rate Thread

Code to split Worksheets into seperat workbooks

 
 
Phil Smith
Guest
Posts: n/a
 
      25th Mar 2009
It would take me forever to figure out how to code this myself. What I
want is to take a workbook with a dozen worksheets, and create 12
seperate worksheets, filled with the formatting and the values, (similar
to a paste special values only) of each worksheet.

I need the values only because I am using a lot of links to create the
worksheets.

Can anyone point me to some code I can hack up?

Thanx

Phil
 
Reply With Quote
 
 
 
 
joel
Guest
Posts: n/a
 
      25th Mar 2009
I'm saving the newbook under the sheet name in the default directory.

Sub Splitbook()
MyPath = ThisWorkbook.Path

For Each sht In ThisWorkbook.Sheets
sht.Copy
ActiveSheet.Cells.Copy
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteValues
ActiveSheet.Cells.PasteSpecial Paste:=xlPasteFormats
ActiveWorkbook.SaveAs _
Filename:=MyPath & "\" & sht.Name & ".xls"
ActiveWorkbook.Close savechanges:=False
Next sht


End Sub

"Phil Smith" wrote:

> It would take me forever to figure out how to code this myself. What I
> want is to take a workbook with a dozen worksheets, and create 12
> seperate worksheets, filled with the formatting and the values, (similar
> to a paste special values only) of each worksheet.
>
> I need the values only because I am using a lot of links to create the
> worksheets.
>
> Can anyone point me to some code I can hack up?
>
> Thanx
>
> Phil
>

 
Reply With Quote
 
Jarek Kujawa
Guest
Posts: n/a
 
      25th Mar 2009
"to take a workbook with a dozen worksheets, and create 12 seperate
worksheets"?

you mean "create 12 seperate WORKBOOKS"? 1 worksheet in each of them?

Sub Separate
Dim ws as Worksheet

Sheets.Add
ActiveSheet.Name = "test"

For Each ws in Activeworkbook.Worksheets
If ws.Name <> "test" Then
With Range(Cells(1,1), ActiveCell.SpecialCells(xlLastCell))
..Copy
..PasteSpecial Paste:=xlPasteValues
End With
ws.Move
End If
Next ws

End Sub



On 25 Mar, 17:58, Phil Smith <p...@nhs-inc.com> wrote:
> It would take me forever to figure out how to code this myself. *What I
> want is to take a workbook with a dozen worksheets, and create 12
> seperate worksheets, filled with the formatting and the values, (similar
> to a paste special values only) of each worksheet.
>
> I need the values only because I am using a lot of links to create the
> worksheets.
>
> Can anyone point me to some code I can hack up?
>
> Thanx
>
> Phil


 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      25th Mar 2009
See this example if i understand you correct
http://www.rondebruin.nl/copy6.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm




"Phil Smith" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> It would take me forever to figure out how to code this myself. What I
> want is to take a workbook with a dozen worksheets, and create 12
> seperate worksheets, filled with the formatting and the values, (similar
> to a paste special values only) of each worksheet.
>
> I need the values only because I am using a lot of links to create the
> worksheets.
>
> Can anyone point me to some code I can hack up?
>
> Thanx
>
> Phil
>
> __________ Information from ESET Smart Security, version of virus signature database 3962 (20090325) __________
>
> The message was checked by ESET Smart Security.
>
> http://www.eset.com
>
>
>


__________ Information from ESET Smart Security, version of virus signature database 3962 (20090325) __________

The message was checked by ESET Smart Security.

http://www.eset.com



 
Reply With Quote
 
Phil Smith
Guest
Posts: n/a
 
      25th Mar 2009
This takes my current workbook, converts all of the sheets to thier
values. My original workbook needs to remain intact with thier links.

It does tell me how to accomplish some of my goal though.

Thanx





Jarek Kujawa wrote:
> "to take a workbook with a dozen worksheets, and create 12 seperate
> worksheets"?
>
> you mean "create 12 seperate WORKBOOKS"? 1 worksheet in each of them?
>
> Sub Separate
> Dim ws as Worksheet
>
> Sheets.Add
> ActiveSheet.Name = "test"
>
> For Each ws in Activeworkbook.Worksheets
> If ws.Name <> "test" Then
> With Range(Cells(1,1), ActiveCell.SpecialCells(xlLastCell))
> .Copy
> .PasteSpecial Paste:=xlPasteValues
> End With
> ws.Move
> End If
> Next ws
>
> End Sub
>
>
>
> On 25 Mar, 17:58, Phil Smith <p...@nhs-inc.com> wrote:
>
>>It would take me forever to figure out how to code this myself. What I
>>want is to take a workbook with a dozen worksheets, and create 12
>>seperate worksheets, filled with the formatting and the values, (similar
>>to a paste special values only) of each worksheet.
>>
>>I need the values only because I am using a lot of links to create the
>>worksheets.
>>
>>Can anyone point me to some code I can hack up?
>>
>>Thanx
>>
>>Phil

>
>

 
Reply With Quote
 
Phil Smith
Guest
Posts: n/a
 
      25th Mar 2009
Works perfectly. Absolutely exactly what I needed as is. Thank you
very much. I truly appreciate it.




joel wrote:
> I'm saving the newbook under the sheet name in the default directory.
>
> Sub Splitbook()
> MyPath = ThisWorkbook.Path
>
> For Each sht In ThisWorkbook.Sheets
> sht.Copy
> ActiveSheet.Cells.Copy
> ActiveSheet.Cells.PasteSpecial Paste:=xlPasteValues
> ActiveSheet.Cells.PasteSpecial Paste:=xlPasteFormats
> ActiveWorkbook.SaveAs _
> Filename:=MyPath & "\" & sht.Name & ".xls"
> ActiveWorkbook.Close savechanges:=False
> Next sht
>
>
> End Sub
>
> "Phil Smith" wrote:
>
>
>>It would take me forever to figure out how to code this myself. What I
>>want is to take a workbook with a dozen worksheets, and create 12
>>seperate worksheets, filled with the formatting and the values, (similar
>>to a paste special values only) of each worksheet.
>>
>>I need the values only because I am using a lot of links to create the
>>worksheets.
>>
>>Can anyone point me to some code I can hack up?
>>
>>Thanx
>>
>>Phil
>>

 
Reply With Quote
 
Jarek Kujawa
Guest
Posts: n/a
 
      26th Mar 2009
....then you might close your original file without saving...


On 25 Mar, 23:55, Phil Smith <p...@nhs-inc.com> wrote:
> This takes my current workbook, converts all of the sheets to thier
> values. *My original workbook needs to remain intact with thier links.
>
> It does tell me how to accomplish some of my goal though.
>
> Thanx
>
>
>
> Jarek Kujawa wrote:
> > "to take a workbook with a dozen worksheets, and create 12 seperate
> > worksheets"?

>
> > you mean "create 12 seperate WORKBOOKS"? 1 worksheet in each of them?

>
> > Sub Separate
> > Dim ws as Worksheet

>
> > Sheets.Add
> > ActiveSheet.Name = "test"

>
> > For Each ws in Activeworkbook.Worksheets
> > If ws.Name <> "test" Then
> > With Range(Cells(1,1), ActiveCell.SpecialCells(xlLastCell))
> > .Copy
> > .PasteSpecial Paste:=xlPasteValues
> > End With
> > ws.Move
> > End If
> > Next ws

>
> > End Sub

>
> > On 25 Mar, 17:58, Phil Smith <p...@nhs-inc.com> wrote:

>
> >>It would take me forever to figure out how to code this myself. *WhatI
> >>want is to take a workbook with a dozen worksheets, and create 12
> >>seperate worksheets, filled with the formatting and the values, (similar
> >>to a paste special values only) of each worksheet.

>
> >>I need the values only because I am using a lot of links to create the
> >>worksheets.

>
> >>Can anyone point me to some code I can hack up?

>
> >>Thanx

>
> >>Phil- Ukryj cytowany tekst -

>
> - Pokaż cytowany tekst -


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Split email address into seperat columns =?Utf-8?B?bWdfc3Zfcg==?= Microsoft Excel Worksheet Functions 1 9th Jan 2006 11:56 AM
Can I split worksheets from one workbook into individual workbooks =?Utf-8?B?Um9zYW5h?= Microsoft Excel Misc 0 19th Sep 2005 08:03 PM
Adding code to workbooks/worksheets using VBA Tony Bell Microsoft Excel Programming 3 22nd Mar 2004 10:27 AM
Change code to make worksheets instead of workbooks mikeb1 Microsoft Excel Programming 3 15th Dec 2003 03:23 PM
VBA code for looping through open workbooks and worksheets Jamie Martin Microsoft Excel Programming 1 24th Jul 2003 06:44 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:25 AM.