Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Need to pull data from the same cell in multiple workbooks.

I have a file with about 200 Excel workbooks. Each workbook has 2 sheets. I
need to total up the values from cell "X12" on sheet2 for all 200 workbooks.
Each workbook has a different name. Is it possible to do this in a new excel
sheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Need to pull data from the same cell in multiple workbooks.

Put this macro into a new workbook. Change the FOLDER as required (from
c:\temp)

Sub GetX12()

Folder = "c:\temp\"

Set SumSht = ActiveSheet
RowCount = 1

FName = Dir(Folder & "*.xls")
Do While FName < ""
Set OldBk = Workbooks.Open(Filename:=Folder & FName)
SumSht.Range("A" & RowCount) = FName
SumSht.Range("B" & RowCount) = OldBk.Sheets("Sheet2").Range("X12")
RowCount = RowCount + 1
OldBk.Close savechanges:=False
FName = Dir()
Loop
End Sub


"Gluefoot" wrote:

I have a file with about 200 Excel workbooks. Each workbook has 2 sheets. I
need to total up the values from cell "X12" on sheet2 for all 200 workbooks.
Each workbook has a different name. Is it possible to do this in a new excel
sheet?

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default Need to pull data from the same cell in multiple workbooks.

This worked perfectly. And it was my first experience creating a macro. Thank
you so much!

"joel" wrote:

Put this macro into a new workbook. Change the FOLDER as required (from
c:\temp)

Sub GetX12()

Folder = "c:\temp\"

Set SumSht = ActiveSheet
RowCount = 1

FName = Dir(Folder & "*.xls")
Do While FName < ""
Set OldBk = Workbooks.Open(Filename:=Folder & FName)
SumSht.Range("A" & RowCount) = FName
SumSht.Range("B" & RowCount) = OldBk.Sheets("Sheet2").Range("X12")
RowCount = RowCount + 1
OldBk.Close savechanges:=False
FName = Dir()
Loop
End Sub


"Gluefoot" wrote:

I have a file with about 200 Excel workbooks. Each workbook has 2 sheets. I
need to total up the values from cell "X12" on sheet2 for all 200 workbooks.
Each workbook has a different name. Is it possible to do this in a new excel
sheet?

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Need to pull data from the same cell in multiple workbooks.

You didn't create the macro, you just ran it!

"Gluefoot" wrote:

This worked perfectly. And it was my first experience creating a macro. Thank
you so much!

"joel" wrote:

Put this macro into a new workbook. Change the FOLDER as required (from
c:\temp)

Sub GetX12()

Folder = "c:\temp\"

Set SumSht = ActiveSheet
RowCount = 1

FName = Dir(Folder & "*.xls")
Do While FName < ""
Set OldBk = Workbooks.Open(Filename:=Folder & FName)
SumSht.Range("A" & RowCount) = FName
SumSht.Range("B" & RowCount) = OldBk.Sheets("Sheet2").Range("X12")
RowCount = RowCount + 1
OldBk.Close savechanges:=False
FName = Dir()
Loop
End Sub


"Gluefoot" wrote:

I have a file with about 200 Excel workbooks. Each workbook has 2 sheets. I
need to total up the values from cell "X12" on sheet2 for all 200 workbooks.
Each workbook has a different name. Is it possible to do this in a new excel
sheet?

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 33
Default Need to pull data from the same cell in multiple workbooks.

maybe you can help me out joel.

"joel" wrote:

Put this macro into a new workbook. Change the FOLDER as required (from
c:\temp)

Sub GetX12()

Folder = "c:\temp\"

Set SumSht = ActiveSheet
RowCount = 1

FName = Dir(Folder & "*.xls")
Do While FName < ""
Set OldBk = Workbooks.Open(Filename:=Folder & FName)
SumSht.Range("A" & RowCount) = FName
SumSht.Range("B" & RowCount) = OldBk.Sheets("Sheet2").Range("X12")
RowCount = RowCount + 1
OldBk.Close savechanges:=False
FName = Dir()
Loop
End Sub


"Gluefoot" wrote:

I have a file with about 200 Excel workbooks. Each workbook has 2 sheets. I
need to total up the values from cell "X12" on sheet2 for all 200 workbooks.
Each workbook has a different name. Is it possible to do this in a new excel
sheet?



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
How can I pull data from multiple user workbooks into one? Stuart Peters Excel Discussion (Misc queries) 4 April 8th 06 11:29 AM
pull data for a company with data in diff cells multiple wrkshts kcoachbiggs Excel Worksheet Functions 0 March 8th 06 09:24 PM
Pull multiple data luk_sr Excel Worksheet Functions 6 August 2nd 05 09:20 PM
Data from closed workbooks (pull func, indirect.ext, etc ....) [email protected] Excel Worksheet Functions 1 June 22nd 05 03:24 PM
How do I pull in multiple data sets at once? Doug Excel Discussion (Misc queries) 0 December 6th 04 12:37 AM


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