Files naming macro

momo6

New Member
Joined
May 24, 2020
Messages
37
Office Version
  1. 365
Platform
  1. Windows
Hi guys, I have the following macro script, I am facing a situation with a folder that contains many subfolders and inside them there is a lot of files, is there by any chance a possibility to modify this macro so instead of displaying the files inside it only, it displays the files inside it + the files inside the subfolders? Thank you very much.


Sub FetchNames()

Dim myPath As String
Dim myFile As String
myPath = Sheet1.[addr]
myFile = Dir(myPath & "*.*")

r = 5
Do While myFile <> ""
Cells(r, 1).Value = myFile
r = r + 1
myFile = Dir
Loop

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Ok I understand but the Forum rules say you should post on the Forum so others can benefit from the information.

You can post the question in another POST and send me the link for me to look at if you want. That is acceptable.

Thanks.
 
Upvote 0

Forum statistics

Threads
1,217,370
Messages
6,136,156
Members
449,995
Latest member
rport

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