theboynorris
New Member
- Joined
- May 26, 2011
- Messages
- 2
Hi
I have a folder that contains 1600 excel files. The files are product spec sheets. I need to extract some of the information from these workbooks to one excel sheet in a new document.
The 1600 excel files are identical in layout. The information I want is not in adjoining rows or cells, I need to select 10 individual cells to import.
I deally what I would like is to be able to import all the data, and write it horizontally across the page, so each file you have one row on the new sheet, and corresponging values from the different spec sheets would appear below each other.
I am currently able to import a range of rows using this code
Option Explicit
Sub GetMyData()
Dim MyDir, FN As String
Dim LR As Long
Application.ScreenUpdating = False
'Runtime
MyDir = "C:\Documents and Settings\....\"
FN = Dir(MyDir & "*.xls")
Do While FN <> ""
If FN <> ThisWorkbook.Name Then
With Workbooks.Open(MyDir & FN)
LR = ThisWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
.Sheets("Sheet1").Rows("3:22").Copy ThisWorkbook.Sheets("Sheet1").Rows(LR + 1)
.Close False
End With
End If
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub
But this is no longer sufficient for my needs, and it would be great if I could just take the individual cells I require.
Thanks a million for any help you can give me.
I have a folder that contains 1600 excel files. The files are product spec sheets. I need to extract some of the information from these workbooks to one excel sheet in a new document.
The 1600 excel files are identical in layout. The information I want is not in adjoining rows or cells, I need to select 10 individual cells to import.
I deally what I would like is to be able to import all the data, and write it horizontally across the page, so each file you have one row on the new sheet, and corresponging values from the different spec sheets would appear below each other.
I am currently able to import a range of rows using this code
Option Explicit
Sub GetMyData()
Dim MyDir, FN As String
Dim LR As Long
Application.ScreenUpdating = False
'Runtime
MyDir = "C:\Documents and Settings\....\"
FN = Dir(MyDir & "*.xls")
Do While FN <> ""
If FN <> ThisWorkbook.Name Then
With Workbooks.Open(MyDir & FN)
LR = ThisWorkbook.Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
.Sheets("Sheet1").Rows("3:22").Copy ThisWorkbook.Sheets("Sheet1").Rows(LR + 1)
.Close False
End With
End If
FN = Dir
Loop
Application.ScreenUpdating = True
End Sub
But this is no longer sufficient for my needs, and it would be great if I could just take the individual cells I require.
Thanks a million for any help you can give me.