Closed Thread
Results 1 to 2 of 2

Loop through folders and only implement code if folder name matches from specified names

  1. #1
    Registered User
    Join Date
    01-20-2018
    Location
    Canada
    MS-Off Ver
    2016
    Posts
    10

    Loop through folders and only implement code if folder name matches from specified names

    Hello all,

    I am new to VBA coding. I had taken a programming course almost 6 years ago and never touched it since. But now I would like to slowly learn to automate a lot of my excel stuff.


    I am wondering how would I code the following:

    I have 10 folders in a particular location on my drive with 7 folders names Item 1, Item 2, Item 3, Item 4, Item 5, Item 6 and Item 7. The remaining 3 folders are not important.

    I would like my code to loop through all the folders in that particular location and if the folder names match any of the specified 7 folder names - Item 1, Item 2, Item 3, Item 4, Item 5, Item 6 and Item 7 - then execute code A for folders Item 1, Item 2 and Item 3 and execute code B for Item 4, Item 5, Item 6 and Item 7.

    Requesting your kindest help.

    Thank you !

  2. #2
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Re: Loop through folders and only implement code if folder name matches from specified nam

    Welcome to the Forum, unfortunately this is a duplicate post and as such will now be closed, you may continue in your other thread.

    https://www.excelforum.com/excel-pro...ml#post4885290

    Thread Closed.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA to loop through a folder and all sub folders opening excel files.
    By Lsxtrkiller in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2017, 06:18 PM
  2. Code to loop through workbooks in folder with specific names
    By stephme55 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-31-2016, 07:31 PM
  3. [SOLVED] Search for file names in main folder and its sub folders
    By YasserKhalil in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 11-09-2015, 01:17 AM
  4. [SOLVED] Loop Through Folder, Create Emails with Sub Folder Names in Subject, Attach files in sub
    By Rschwar23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-30-2015, 10:06 AM
  5. Create FOLDER in subfoldesr and move folders with specific names into FOLDER
    By Amarjeet Singh in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2015, 09:46 AM
  6. Loop Through all Folders - *Ignore Folder Shortcuts*
    By R_S_6 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-08-2013, 05:53 AM
  7. [SOLVED] Renaming Folders in a macro but so far all I can do is loop thru the folder.
    By jody1234 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-03-2013, 02:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1