Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Formula for adding a cell in multiple workbooks

I want to add a cell from 52 different workbooks into another "Year End"
workbook. Is there a formula that makes this easier than having to open all
52 workbooks at one time and going into each to select that cell for the
formula?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,071
Default Formula for adding a cell in multiple workbooks

Place all 52 files and the "Year End" file into one folder with NO other
files. Place this macro into the "Year End" file and run it FROM THAT
FOLDER. This macro will open each file and will sum the value of cell A1 in
sheet "SheetName" from every file. The result will be displayed in a
message box at the end. If you want the sum placed in the "Year End" file
in A1 of the active sheet, replace the Msgbox line in this code with:
Range("A1")=TheSum
HTH Otto

Sub AllFolderFiles()
Dim wb As Workbook, TheFile As String
Dim MyPath As String, TheSum As Double
TheSum = 0
MyPath = ThisWorkbook.Path
ChDir MyPath
TheFile = Dir("*.xls")
Do While TheFile < ""
If TheFile < ThisWorkbook.Name Then
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
The Sum = TheSum + Sheets("SheetName").Range("A1")
wb.Close
End If
TheFile = Dir
Loop
MsgBox TheSum
End Sub

"PaPr" wrote in message
...
I want to add a cell from 52 different workbooks into another "Year End"
workbook. Is there a formula that makes this easier than having to open
all
52 workbooks at one time and going into each to select that cell for the
formula?


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
Adding a Row to Multiple Workbooks LPS Excel Discussion (Misc queries) 0 May 31st 07 05:04 PM
Adding multiple workbooks together Keith Excel Discussion (Misc queries) 1 August 8th 05 09:39 PM
adding certain cells in multiple worksheets in multiple workbooks Stephen via OfficeKB.com Excel Worksheet Functions 1 February 4th 05 08:31 PM
Adding cells from multiple workbooks Blackcat Excel Discussion (Misc queries) 6 January 19th 05 09:50 AM
Re What is the formula for adding multiple numbers in a cell merlin_au Excel Discussion (Misc queries) 2 January 4th 05 11:50 AM


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"