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

Each month I will have between 28-31 workbooks located in
directory C:\Renewals Reports and will need to
combine/compile all the data in columns A:Z in all these
files into one workbook called Renewals.xls. Now instead
of manually opening each workbook and copying and pasting
all the data into my Renewals.xls spreadhseet, I would
rather have a code to do it all automatically.

Currently I have the following code(se below) but its not
quite what I need. This code looks in C:\Renewals Reports
and opens up each spreadhseet file and puts the value of
cell A2 into my Renewals.xls file starting in cell A2.
Whatever value is in cell A2 of the next workbook is put
in the next cell down in Renewals.xls.

Instead of getting the data in cell A2 of all the
worksheets, how do I get the data in all the cells in
column A:Z(not including blank cells)?


Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Renewals Reports" 'ChDrive
FOLDERNAME
ChDir FOLDERNAME
Set Dest = Range("A2")
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets(1).Rows(2).Copy Destination:=Dest
WB.Close savechanges:=False
Set Dest = Dest(2, 1)
FName = Dir()
Loop

Thanks
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Consolidating worksheets

Hi

Check out this page
http://www.rondebruin.nl/copy3.htm

And a new one that use ADO
http://www.rondebruin.nl/ado.htm


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


"Todd Huttenstine" wrote in message ...
Each month I will have between 28-31 workbooks located in
directory C:\Renewals Reports and will need to
combine/compile all the data in columns A:Z in all these
files into one workbook called Renewals.xls. Now instead
of manually opening each workbook and copying and pasting
all the data into my Renewals.xls spreadhseet, I would
rather have a code to do it all automatically.

Currently I have the following code(se below) but its not
quite what I need. This code looks in C:\Renewals Reports
and opens up each spreadhseet file and puts the value of
cell A2 into my Renewals.xls file starting in cell A2.
Whatever value is in cell A2 of the next workbook is put
in the next cell down in Renewals.xls.

Instead of getting the data in cell A2 of all the
worksheets, how do I get the data in all the cells in
column A:Z(not including blank cells)?


Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Renewals Reports" 'ChDrive
FOLDERNAME
ChDir FOLDERNAME
Set Dest = Range("A2")
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets(1).Rows(2).Copy Destination:=Dest
WB.Close savechanges:=False
Set Dest = Dest(2, 1)
FName = Dir()
Loop

Thanks
Todd Huttenstine



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Consolidating worksheets

Thanks Ron. I like your site.


"Ron de Bruin" wrote in message
...
Hi

Check out this page
http://www.rondebruin.nl/copy3.htm

And a new one that use ADO
http://www.rondebruin.nl/ado.htm


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


"Todd Huttenstine" wrote in message

...
Each month I will have between 28-31 workbooks located in
directory C:\Renewals Reports and will need to
combine/compile all the data in columns A:Z in all these
files into one workbook called Renewals.xls. Now instead
of manually opening each workbook and copying and pasting
all the data into my Renewals.xls spreadhseet, I would
rather have a code to do it all automatically.

Currently I have the following code(se below) but its not
quite what I need. This code looks in C:\Renewals Reports
and opens up each spreadhseet file and puts the value of
cell A2 into my Renewals.xls file starting in cell A2.
Whatever value is in cell A2 of the next workbook is put
in the next cell down in Renewals.xls.

Instead of getting the data in cell A2 of all the
worksheets, how do I get the data in all the cells in
column A:Z(not including blank cells)?


Dim FName As String
Dim WB As Workbook
Dim Dest As Range
Const FOLDERNAME = "C:\Renewals Reports" 'ChDrive
FOLDERNAME
ChDir FOLDERNAME
Set Dest = Range("A2")
FName = Dir("*.xls")
Do Until FName = ""
Set WB = Workbooks.Open(FName)
WB.Worksheets(1).Rows(2).Copy Destination:=Dest
WB.Close savechanges:=False
Set Dest = Dest(2, 1)
FName = Dir()
Loop

Thanks
Todd Huttenstine





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
Consolidating multiple worksheets into one [email protected] Excel Worksheet Functions 2 April 2nd 09 06:49 PM
Consolidating worksheets mimilave Excel Worksheet Functions 0 January 14th 08 08:03 PM
Consolidating worksheets into one tab Tonia Excel Worksheet Functions 2 August 27th 07 04:54 PM
Consolidating multiple worksheets into one. Bovine Jones Excel Discussion (Misc queries) 2 October 17th 06 09:54 AM
Consolidating worksheets Joeflo Excel Discussion (Misc queries) 1 April 22nd 06 11:47 PM


All times are GMT +1. The time now is 11:44 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"