Browse subsubfolders and check name

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I've a folder named "Codes":

VBA Code:
C:\Users\john.smith\Desktop\Codes

Inside the folder, I have a bunch of subfolders (unzipped and zipped). It's important to say that I can't know their name a priori.

For example:
VBA Code:
C:\Users\john.smith\Desktop\Codes\zzzzz
C:\Users\john.smith\Desktop\Codes\yyyyy
C:\Users\john.smith\Desktop\Codes\wwwww


Inside these subfolders, I have other subfolders.

For example:
VBA Code:
C:\Users\john.smith\Desktop\Codes\zzzzz\aaa
C:\Users\john.smith\Desktop\Codes\zzzzz\bbb
C:\Users\john.smith\Desktop\Codes\yyyyy\rrr
C:\Users\john.smith\Desktop\Codes\wwwww\ppp
C:\Users\john.smith\Desktop\Codes\wwwww\nnn
C:\Users\john.smith\Desktop\Codes\wwwww\ccc
C:\Users\john.smith\Desktop\Codes\wwwww\kkk


Now, in the end of previous operations I got a range in my Excel sheet whose name is
VBA Code:
rng



The job is:
1) Check if the subsubfolders name (aaa bbb rrr ppp nnn ccc kkk) matches one of the values in rng.
2) If yes, copy the subsubfolders and paste in
VBA Code:
C:\Users\john.smith\Desktop\copied


Could you help me?

Thank's.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

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