With your help I have managed to create unique files for any individual in
the database. Now... let's say that I made 20 unique files (could be any
number, depending on the manager's load). These 20 unique files are saved
in a specific folder so that they can be viewed individually. That is good
enough for me, but I'm certain that the next demand will be to combine these
files into a single workbook so they can select tabs at the bottom (where
the "sheets" are listed). How do I get these files into the tabs?
Bart
Easiest way...manually....
Open all the workbooks simultaneously.
Windows/Arrange/Tiled
Make sure that all the tabs in each of the workbooks are uniquely named.
Drag them one at a time into a common workbook.
Use the Ctrl key to "add" them as opposed to "moving" them.
(the little + sign should appear)
John
Sub CopySheets()
Dim x As Integer
Dim FName As String
Dim MyPath As String
Dim oldname As String
Dim newname As String
Dim ws As Worksheet
x = Workbooks("Cook1").Sheets.Count
'the workbook that take sheets from other workbooks
'should be in a separate directory to avoid conflict
'so change the reference to the dir where the files are
ChDir "C:\My Documents\xltest"
Application.ScreenUpdating = False
'Set the path
MyPath = "C:\My Documents\xltest\"
'Find the first excel file
FName = Dir(MyPath & "*.xls")
'Stop loop when no more excel files
Do While Len(FName) > 0
'open the file and reference the first sheet
Set ws = Workbooks.Open(FName).Worksheets(1)
'give the name of the file and Copy to Cook1.xls
oldname = CStr(ws.Name)
newname = CStr(Left(CStr(FName), Len(CStr(FName)) - 4))
With ws
.Name = newname
.Copy After:=Workbooks("Cook1.xls").Sheets(x)
.Name = oldname
End With
x = x + 1
'Close the file
ws.Parent.Close False
'Find the next excel file
FName = Dir()
Loop
Set ws = Nothing
Application.ScreenUpdating = True
End Sub
"Bart" <so...@spamsucks.com> wrote in message
news:BF7fa.620$bJ...@fe07.atl2.webusenet.com...