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

Hi All

I am very novice at VBA. I only know how to record macros and then
modify them to do what I need. Using Excel 2002.

I am trying to combine data from multiple (about 100) workbooks into
one vertical list in a different workbook. Each workbook has a sheet
named "IO" with four values I want to copy (cells B2:E2) plus the name
of the workbook in cell A1. The resulting list would look like this:

A B C D E
1 WorkbookName1 Value1 Value2 Value3 Value4

2 WorkbookName2 Value1 Value2 Value3 Value4

3 etc...

I've copied someone's macro that will cycle through the workbooks in a
directory and copy the cells I need. The only thing that I can't do
is figure out how to paste it in the next empty row. I am sure this
is an easy question, just not sure of the code. Here is what I have
so far:

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)
'MsgBox FileList(Counter)
Workbooks.Open Filename:=FileList(Counter)
ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Co unt).Name = thisfile
Windows(thisfile).Activate
Sheets("IO").Select
Range("A1").Select
Selection.Copy

Windows("NewBook.xls").Activate 'this is open to the correct sheet
Range("A1").Select
'this is where I need it to select the next blank row in column A and
paste

Windows(thisfile).Activate
Sheets("IO").Select
Range("B2:E2").Select
Selection.Copy

Windows("NewBook.xls").Activate
Range("B1").Select
'this is where I need it to select the cell in column B next to the
workbook name that I just pasted

Windows(thisfile).Activate
ActiveWorkbook.Save
Workbooks(thisfile).Close
Next
Application.Calculation = xlAutomatic

End Sub
 
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 08:28 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"