+ Reply to Thread
Results 1 to 4 of 4

VBA Syntax Loop - Different Workbooks in 1 path

  1. #1
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    VBA Syntax Loop - Different Workbooks in 1 path

    Can anyone help with a VBA syntax that loops through all folders in a certain path (EG: H:/Reports/Pick Reports),
    the path has different folders called 2014,2015 etc and each folder has months. and each month has daily workbook.

    my target is to pull out data from a particular worksheet in the daily workbooks.

  2. #2
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: VBA Syntax Loop - Different Workbooks in 1 path

    Do I understand you right when you have a folder structure like

    "H:\Reports\Pick Reports\2014\January\Day1\" where there are 31 day folders for January?

    And you wish to extract data from all these files?

    Alf

  3. #3
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    Re: VBA Syntax Loop - Different Workbooks in 1 path

    Quote Originally Posted by Alf View Post
    Do I understand you right when you have a folder structure like

    "H:\Reports\Pick Reports\2014\January\Day1\" where there are 31 day folders for January?

    And you wish to extract data from all these files?

    Alf
    Hi Alf

    Yes, That's is correct however there are more folders eg: 2014 and 2015 and then folders for each month inside these and then the files are in each folder named as Picking Figures 05.03.2015.xlsx and so on

    We only want to extract the data from the sheet named Sheet1 within all of these files along with the name of the file so we know what date this relates too.

    Thanks

  4. #4
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,758

    Re: VBA Syntax Loop - Different Workbooks in 1 path

    Ok so you have a folder system like "H:\Reports\Pick Reports\2014\" where all the 2014 files are kept i.e. from 01.01.2014.xlsx to 31.12.2014.xlxs and a second subfolder
    "H:\Reports\Pick Reports\2015\" for all the 2015 files.

    Then perhaps a macro like this could be of help

    Please Login or Register  to view this content.
    Alf

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Syntax Compile Error - How to work around this (file path doesn't exist)
    By Harribone in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2015, 08:19 AM
  2. Need help writing Loop syntax
    By sslack88 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-26-2012, 11:02 PM
  3. VBA Syntax to loop and do if then else statements
    By 1234567890 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 01-19-2011, 10:39 PM
  4. [SOLVED] loop syntax
    By Knox in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2006, 02:10 PM
  5. Pass path result from FilePicker to vlookup with correct syntax
    By sabs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-10-2005, 06:44 PM

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