LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Combine multiple books into one list

Thanks for the help, Dave. Sorry for the confusion...I think I had left a
line out and had another one that I didn't need. Here is the final code and
it works great.

Sub RegionList()
Dim FileList() As String
Dim Counter As Long
Dim NextFile As String
Dim thisfile As String
Dim DirToSearch As String
DirToSearch = "C:\Documents and Settings\User1\My Documents\CBAs"
Counter = 0
NextFile = Dir(DirToSearch & "\" & "*.xls")
Do Until NextFile = ""
ReDim Preserve FileList(Counter)
FileList(Counter) = DirToSearch & "\" & NextFile
Counter = Counter + 1
NextFile = Dir()
Loop
Application.Calculation = xlManual
On Error Resume Next
For Counter = LBound(FileList) To UBound(FileList)
Workbooks.Open Filename:=FileList(Counter)
thisfile = ActiveWorkbook.Name
'Paste Name
Windows(thisfile).Activate
Sheets("IO").Select
Range("A1").Select
Selection.Copy
Windows("NewBook.xls").Activate
Range("A65536").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False

'Paste Investment Values
Windows(thisfile).Activate
Sheets("CBA Template").Select
Range("B2:E2").Select
Selection.Copy
Windows("NewBook.xls").Activate
Range("B65536").End(xlUp).Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Workbooks(thisfile).Saved = True
Workbooks(thisfile).Close
Next
Application.Calculation = xlAutomatic
End Sub

Steve Mackay


"Dave Peterson" wrote in message
...
I was kind of confused, but maybe this'll give you some ideas. It uses a
nice
function from Chip Pearson to check to see if a worksheet exists.





 
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
Viewing multiple books David Excel Discussion (Misc queries) 0 June 4th 09 12:53 AM
multiple sheets 2 work books capt c Excel Worksheet Functions 0 April 8th 09 03:03 PM
Large Project with multiple books bobb Excel Discussion (Misc queries) 0 November 1st 06 06:37 PM
Viewing multiple books cdyork Excel Discussion (Misc queries) 0 August 3rd 05 01:08 PM
How can I enter an online list of library books into Excell's Boo. eddycreek Setting up and Configuration of Excel 1 December 30th 04 03:07 PM


All times are GMT +1. The time now is 05:08 AM.

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"