Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Split workbook

MS Office 2000, Windows 2000

Able to split the workbook so each sheet creates a new
workbook with the following macro.

Public Sub SpitWorkbook()
Dim W As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each W In Worksheets
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "/" & W.Name
ActiveWorkbook.Close
Next W

Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

However, as each sheet represents an employee I need the
employees that report to the same manager copied to the
same workbook.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Split workbook

Assume the managers name is in Cell B2 of each sheet

Option Explicit
Public Sub SpitWorkbook()
Dim W As Worksheet
Dim bk As Workbook
Dim sCheryl As String
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each W In Worksheets
sCheryl = W.Range("B2").Value
Set bk = Nothing
On Error Resume Next
Set bk = Workbooks(sCheryl)
On Error GoTo 0
If bk Is Nothing Then
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:= _
ThisWorkbook.Path & "\" & sCheryl & ".xls"
Else
ActiveSheet.Copy After:=bk.Worksheets( _
bk.Worksheets.Count)
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
bk.Save
End If
Next W
For Each bk In Application.Workbooks
If bk.Name < ThisWorkbook.Name Then
bk.Close Savechanges:=False
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

Code is untested, but should be work.

--
Regards,
Tom Ogilvy


"Cheryl" wrote in message
...
MS Office 2000, Windows 2000

Able to split the workbook so each sheet creates a new
workbook with the following macro.

Public Sub SpitWorkbook()
Dim W As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each W In Worksheets
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "/" & W.Name
ActiveWorkbook.Close
Next W

Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

However, as each sheet represents an employee I need the
employees that report to the same manager copied to the
same workbook.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Split workbook

More information please

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Cheryl" wrote in message ...
MS Office 2000, Windows 2000

Able to split the workbook so each sheet creates a new
workbook with the following macro.

Public Sub SpitWorkbook()
Dim W As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each W In Worksheets
ActiveSheet.Copy
Cells.Copy
Cells.PasteSpecial xlPasteValues
Cells(1).Select
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path
& "/" & W.Name
ActiveWorkbook.Close
Next W

Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub

However, as each sheet represents an employee I need the
employees that report to the same manager copied to the
same workbook.



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
how do i work on both workbook when using split windows Natanya Steyn Excel Discussion (Misc queries) 3 October 17th 07 03:32 PM
In a workbook, how do I not have initials split and wrapped? Leeney Excel Discussion (Misc queries) 11 October 11th 07 01:33 PM
Separate/Split all the worksheets in a workbook into different fil tnacius rottie Excel Discussion (Misc queries) 0 September 14th 07 06:16 PM
Workbook split into two after opening Katherine Excel Discussion (Misc queries) 2 December 28th 06 10:55 PM
split data in many workbook Dave Peterson[_3_] Excel Programming 0 July 23rd 03 02:47 AM


All times are GMT +1. The time now is 06:51 AM.

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

About Us

"It's about Microsoft Excel"