sljanbu
11-03-2011, 02:23 PM
Hello.
I hope someone can help me with the VBA-code that will solve my request. I've spent some time searhing the net to find the VBA-code for this, but have not succeeded findig it.
In Excel I have my filenames listed in column A starting in cell A1 and downwards. Example:
filename1.txt
filename2.txt
filename3.txt
etc.
These files are listed in one of many subfolders starting below path C:\MyFiles\2011, e.g.:
C:\Myfiles\2011\01
C:\Myfiles\2011\02
C:\Myfiles\2011\03
C:\Myfiles\2011\04
ect.
I need a VBA-code that searches through C:\MyFiles\2011 an all its subfolders to find the complete path for each file listed in cell A1 and downwards.
The result for each file I want to appear in cell B1 and downwards.
An example of the final result should look like this:
Column A ------- Column B
filename1.txt --- C:\Myfiles\2011\02
filename2.txt --- C:\Myfiles\2011\05
filename3.txt --- C:\Myfiles\2011\05
filename4.txt --- C:\Myfiles\2011\01
filename5.txt --- C:\Myfiles\2011\03
ect. ----------- etc.
I'm a complete novice in VBA so I have not started on building any VBA-code myselves to solve my problem.
Best regards,
Stig
I hope someone can help me with the VBA-code that will solve my request. I've spent some time searhing the net to find the VBA-code for this, but have not succeeded findig it.
In Excel I have my filenames listed in column A starting in cell A1 and downwards. Example:
filename1.txt
filename2.txt
filename3.txt
etc.
These files are listed in one of many subfolders starting below path C:\MyFiles\2011, e.g.:
C:\Myfiles\2011\01
C:\Myfiles\2011\02
C:\Myfiles\2011\03
C:\Myfiles\2011\04
ect.
I need a VBA-code that searches through C:\MyFiles\2011 an all its subfolders to find the complete path for each file listed in cell A1 and downwards.
The result for each file I want to appear in cell B1 and downwards.
An example of the final result should look like this:
Column A ------- Column B
filename1.txt --- C:\Myfiles\2011\02
filename2.txt --- C:\Myfiles\2011\05
filename3.txt --- C:\Myfiles\2011\05
filename4.txt --- C:\Myfiles\2011\01
filename5.txt --- C:\Myfiles\2011\03
ect. ----------- etc.
I'm a complete novice in VBA so I have not started on building any VBA-code myselves to solve my problem.
Best regards,
Stig