Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Running formulas with data from mulitple workbooks

I need to create a summary report that uses various formulas (count, sum,
datedif etc) that pull data from over 900 workbooks located in a single
folder. All of the workbooks are formatted exactly the same with the same
variables. I want this summary report to have each row represent one
workbook with the columns being each new calculation that I run. I know
nothing of macros and have been thrown into this. Perhaps giving an example
with SUM formula may be a good place to start.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Running formulas with data from mulitple workbooks

This should get you started.

Option Explicit

Sub CreateSummaryWorkbook()

Dim myFolder As String
Dim myFile As String
Dim myWB As Excel.Workbook
Dim aWB As Excel.Workbook
Dim aWS As Excel.Worksheet

myFolder = "C:/" 'Change to your folder name

Set aWB = Workbooks.Add
Set aWS = aWB.Worksheets(1)
aWS.Name = "Summary"


If Right(myFolder, 1) < "/" Then
myFolder = myFolder & "/"
End If

myFile = Dir(myFolder & "*.x*")

If myFile = "" Then Exit Sub

Do
Set myWB = Workbooks.Open(myFolder & myFile, UpdateLinks:=False,
ReadOnly:=True)

'Do all of your summary work here

'I'll leave this for someone else to help with. :)

'Close workbook
myWB.Close savechanges:=False

myFile = Dir

Loop While myFile < ""

End Sub

--
HTH,

Barb Reinhardt



"JerseyInDC" wrote:

I need to create a summary report that uses various formulas (count, sum,
datedif etc) that pull data from over 900 workbooks located in a single
folder. All of the workbooks are formatted exactly the same with the same
variables. I want this summary report to have each row represent one
workbook with the columns being each new calculation that I run. I know
nothing of macros and have been thrown into this. Perhaps giving an example
with SUM formula may be a good place to start.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Running formulas with data from mulitple workbooks

Minor tweaks. Try this (after changing the folder name) and see what you've
got. It doesn't do any summaries yet, but does give a list of the workbooks
in the folder.

Option Explicit

Sub CreateSummaryWorkbook()

Dim myFolder As String
Dim myFile As String
Dim myWB As Excel.Workbook
Dim aWB As Excel.Workbook
Dim aWS As Excel.Worksheet
Dim lRow As Long

myFolder = "C:/" 'Change to your folder name

Set aWB = Workbooks.Add
Set aWS = aWB.Worksheets(1)
aWS.Name = "Summary"
aWS.Cells(1, 1).Value = "Workbook Name"

If Right(myFolder, 1) < "/" Then
myFolder = myFolder & "/"
End If

myFile = Dir(myFolder & "*.x*")

If myFile = "" Then Exit Sub
lRow = 1
Do
Set myWB = Workbooks.Open(myFolder & myFile, UpdateLinks:=False,
ReadOnly:=True)
lRow = lRow + 1
'Do all of your summary work here
aWS.Cells(lRow, 1) = myWB.Name

'Close workbook
myWB.Close savechanges:=False

myFile = Dir

Loop While myFile < ""

End Sub

--
HTH,

Barb Reinhardt



"JerseyInDC" wrote:

I need to create a summary report that uses various formulas (count, sum,
datedif etc) that pull data from over 900 workbooks located in a single
folder. All of the workbooks are formatted exactly the same with the same
variables. I want this summary report to have each row represent one
workbook with the columns being each new calculation that I run. I know
nothing of macros and have been thrown into this. Perhaps giving an example
with SUM formula may be a good place to start.

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
Copy selected mulitple worksheets to mulitple new workbooks Ian Excel Programming 0 March 8th 07 08:12 PM
Copy selected mulitple worksheets to mulitple new workbooks Vergel Adriano Excel Programming 0 March 8th 07 06:57 PM
link to mulitple workbooks violet Excel Programming 2 November 20th 06 06:17 AM
separate data into mulitple workbooks [email protected] Excel Discussion (Misc queries) 1 July 4th 06 05:59 PM
Running a macro on mulitple files Chris Excel Programming 1 December 8th 04 11:02 PM


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