Copying cells from 194 workbooks

oreo haven

Board Regular
Joined
May 15, 2008
Messages
65
I have 194 Workbooks that all contain data on the first sheet only. I need to go into each sheet and pull the information from cell B6 and F21. That information needs to be copied to a new workbook into columns A and B so when I am done I have 194 lines in two columns.
Each of the workbooks I am pulling from have the info I need in Sheet1.

Is this possible, or do I need to do a lot of copying and pasting? If it is possible, how do I do it? DOes anyone have any ideas?

Thanks,

Jon
 
change to
Code:
Sub test()
Dim myDir As String, fn As String, n As Long
myDir = "C:\Documents and Settings\jsd\Desktop\400_TON\ALL SHEETS\"
fn = Dir(myDir & "*.xls")
Do While fn <> ""
    If fn <> ThisWorkbook.Name Then
        n = n + 1
        With Workbooks.Open(myDir & fn)
            With .Sheets(1)
                ThisWorkbook.Sheets(1).Cells(n, 1).Resize(, 2).Value = _
                Array(.Range("F21").Value, fn)
            End With
            .Close False
        End With
    End If
    fn = Dir
Loop
End Sub
<!-- / message -->
 
Upvote 0

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.

Forum statistics

Threads
1,215,756
Messages
6,126,692
Members
449,331
Latest member
smckenzie2016

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top