Hello,
would you please help me, i'm stuck with this problem
i have several files that have information in two columns: A the name and B the data, i need to collect the data (in column B) of all the files and subfiles of the folder where the name is (the name i'm looking for could be on different rows) Part #: and part Name:
<table style="width: 197pt; border-collapse: collapse;" x:str="" border="0" cellpadding="0" cellspacing="0" width="262"><colgroup><col style="width: 139pt;" width="185"><col style="width: 58pt;" width="77"></colgroup><tbody><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); width: 139pt; height: 12.75pt; background-color: transparent;" height="17" width="185">Part #:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); width: 58pt; background-color: transparent;" x:num="1234567890" width="77">1234567890</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Revision:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">
</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Part Name:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">new cover black ink</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Manufacturing Location:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">Queretaro</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Date:</td><td class="xl24" style="border: medium none rgb(236, 233, 216); background-color: transparent;">17-04-07</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Quote prepared by:</td><td class="xl25" style="border: medium none rgb(236, 233, 216); background-color: transparent;">PGC</td></tr></tbody></table>
I'm using this code, but it only gave me the value on the cell A5, and only for the files that are on Q:\Estimating\customer\ and not in the subfolders.
would you please help me, i'm stuck with this problem
i have several files that have information in two columns: A the name and B the data, i need to collect the data (in column B) of all the files and subfiles of the folder where the name is (the name i'm looking for could be on different rows) Part #: and part Name:
<table style="width: 197pt; border-collapse: collapse;" x:str="" border="0" cellpadding="0" cellspacing="0" width="262"><colgroup><col style="width: 139pt;" width="185"><col style="width: 58pt;" width="77"></colgroup><tbody><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); width: 139pt; height: 12.75pt; background-color: transparent;" height="17" width="185">Part #:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); width: 58pt; background-color: transparent;" x:num="1234567890" width="77">1234567890</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Revision:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">
</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Part Name:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">new cover black ink</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Manufacturing Location:</td><td class="xl23" style="border: medium none rgb(236, 233, 216); background-color: transparent;">Queretaro</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Date:</td><td class="xl24" style="border: medium none rgb(236, 233, 216); background-color: transparent;">17-04-07</td></tr><tr style="height: 12.75pt;" height="17"><td class="xl22" style="border: medium none rgb(236, 233, 216); height: 12.75pt; background-color: transparent;" height="17">Quote prepared by:</td><td class="xl25" style="border: medium none rgb(236, 233, 216); background-color: transparent;">PGC</td></tr></tbody></table>
I'm using this code, but it only gave me the value on the cell A5, and only for the files that are on Q:\Estimating\customer\ and not in the subfolders.
Code:
Sub ListFilesInFolder()
Application.ScreenUpdating = False
Dim FN As String ' For File Name
Dim ThisRow As Long
Dim FileLocation As String
Dim xlMaster As Worksheet, xlData As Worksheet
Set xlMaster = ActiveWorkbook.ActiveSheet
ThisRow = 2
FileLocation = "Q:\Estimating\customer\"
FN = Dir(FileLocation)
With xlMaster
Do Until FN = ""
ThisRow = ThisRow + 1
.Cells(ThisRow, 1) = FN ' Puts filename in first column
.Cells(ThisRow, 2) = FileDateTime(FileLocation & FN) ' puts date last modified in second column
FN = Dir
If open_file(FileLocation, .Cells(ThisRow, 1)) Then
Set xlData = ActiveWorkbook.ActiveSheet
.Cells(ThisRow, 3) = xlData.Range("a5")
xlData.Parent.Close False
'uncomment the else and exit to stop processing if unable to open a file.
'or put in your own error handling
'Else
'Exit Sub
End If
Loop
End With
Application.ScreenUpdating = True
End Sub
Last edited by a moderator: