Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 47
Default Taking w/sheets out of a workbook

I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 84
Default Taking w/sheets out of a workbook

On 5/18/2010 12:56 PM, gail wrote:
I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?


You can easily select/copy/paste a worksheet to a new Excel workbook,
then go back and delete the sheet in the original workbook.

Bill
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Taking w/sheets out of a workbook

A file is a workbook.

Do you want to copy/move all sheets out a workbook to another workbook?

Simply save the workbook as another name.

You want to move some of the sheets to a new workbook?

Select the sheets by CTRL + click then right-click and "move or copy"

Select "create a copy" or not if you just want to move the sheets.

To destination.........new workbook or any open workbook.


Gord Dibben MS Excel MVP

On Tue, 18 May 2010 12:56:01 -0700, gail
wrote:

I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Taking w/sheets out of a workbook

hi
what is your definition of a "file"?

regards
FSt1

"gail" wrote:

I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Taking w/sheets out of a workbook

A worksheet outside of a workbook is not possible. Every worksheet is
by definition within a workbook. If you want to save each worksheet
in the workbook to its own workbook, containing only that sheet, use
code like

Sub AAA()
Dim WS As Worksheet
Dim Path As String
Path = "D:\Test\" '<<<< CHANGE
For Each WS In ThisWorkbook.Worksheets
WS.Copy
ActiveWorkbook.SaveAs Path & WS.Name & ".xls", xlExcel8
ActiveWorkbook.Close savechanges:=True
Next WS
End Sub

Change the value of the Path variable, marked with '<<< to the folder
name in which the new workbooks should be saved.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com





On Tue, 18 May 2010 12:56:01 -0700, gail
wrote:

I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?



  #6   Report Post  
Senior Member
 
Location: Hyderabad
Posts: 237
Default

Quote:
Originally Posted by gail View Post
I have a workbook w/ sheets and need to get them out of the w/book and into a
file.
I have tried to move/copy
and also just copying the sheet.
Any ideas?
'bala sesharao created to save the worksheets as seperate workbooks
Private Sub Workbook_Open()
Call Copy_Every_Sheet_To_New_Workbook

End Sub
Sub Copy_Every_Sheet_To_New_Workbook()
'Working in 97-2007
Dim FileExtStr As String
Dim FileFormatNum As Long
Dim Sourcewb As Workbook
Dim Destwb As Workbook
Dim sh As Worksheet
Dim DateString As String
Dim FolderName As String

With Application
.ScreenUpdating = False
.EnableEvents = False
.Calculation = xlCalculationManual
End With

'Copy every sheet from the workbook with this macro
Set Sourcewb = ThisWorkbook

'Create new folder to save the new files in
DateString = Format(Now, "yyyy-mm-dd hh-mm-ss")
FolderName = Sourcewb.Path & "\" & Sourcewb.Name & " " & DateString
MkDir FolderName

'Copy every visible sheet to a new workbook
For Each sh In Sourcewb.Worksheets

'If the sheet is visible then copy it to a new workbook
If sh.Visible = -1 Then
sh.Copy

'Set Destwb to the new workbook
Set Destwb = ActiveWorkbook

'Determine the Excel version and file extension/format
With Destwb
End With

'Change all cells in the worksheet to values if you want
If Destwb.Sheets(1).ProtectContents = False Then
With Destwb.Sheets(1).UsedRange
.Cells.Copy
.Cells.PasteSpecial xlPasteValues
.Cells(1).Select
End With
Application.CutCopyMode = False
End If
FileFormatNum = InputBox("enter the version number for", "versioning", "xlsx - 51, xlsm - 52,xls - 56,xlsb - 50")





'Save the new workbook and close it
With Destwb
.SaveAs FolderName _
& "\" & Destwb.Sheets(1).Name & FileExtStr, _
FileFormat:=FileFormatNum
.Close False
End With

End If
GoToNextSheet:
Next sh

MsgBox "You can find the files in " & FolderName

With Application
.ScreenUpdating = True
.EnableEvents = True
.Calculation = xlCalculationAutomatic
End With
End Sub
__________________
Thanks
Bala
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking specific rows from on workbook to create another workbook Michelle Excel Worksheet Functions 1 May 12th 07 04:54 AM
Taking a workbook out of Data Tracking will Excel Worksheet Functions 0 April 17th 07 03:52 PM
Multiple Sheets (Need to create 500 individual sheets in one workbook, pulling DATA Amaxwell Excel Worksheet Functions 4 August 17th 06 06:23 AM
add new sheets in a workbook with new sheets being a variable [email protected] Excel Discussion (Misc queries) 1 April 11th 06 08:38 PM
How to repeat a code for selected sheets (or a contiguous range of sheets) in a Workbook? Dmitry Excel Worksheet Functions 6 March 29th 06 12:43 PM


All times are GMT +1. The time now is 09:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"