Need to pull data from the same cell in multiple workbooks.

G

Gluefoot

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?
 
J

joel

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
 
G

Gluefoot

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

Help with cell function

maybe you can help me out joel.

joel said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top