+ Reply to Thread
Results 1 to 4 of 4

cycle / loop through files

  1. #1
    Registered User
    Join Date
    03-30-2019
    Location
    Chattanooga, Tennesse, USA
    MS-Off Ver
    2016
    Posts
    3

    cycle / loop through files

    I have 41 workbooks in a folder with identical formatting but fairly random file names and I want to cycle through each one to process a particular list object (table) spreadsheet.

    Presently, I manually change the file name to process each file one at a time.

    Would like to use a For /Next loop.

    Sub test()

    myPathFileName = "C:\Local\GFH PRC5 2021 Inventory 7.5m02 _v14.xlsm"
    myLOname = "Networking" 'table name in a spreadsheet also named Networking
    Call Process_File((myPathFileName), (myLOname))

    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,522

    Re: cycle / loop through files

    Does this work for you?
    All files (workbooks) are in one Folder, including the workbook that has the code in it.
    Please Login or Register  to view this content.
    Note: It does all workbooks in the folder. Don't have any workbooks in that folder that don't need to be worked on.

  3. #3
    Registered User
    Join Date
    03-30-2019
    Location
    Chattanooga, Tennesse, USA
    MS-Off Ver
    2016
    Posts
    3

    Re: cycle / loop through files

    Thanks for the help!
    Will take a look soon!

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: cycle / loop through files

    Does you Process_File sub open, process and close the workbook with the filename/path that has been passed to it?
    If posting code please use code tags, see here.

+ 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. Which cycle of a loop am I at ?
    By Jaime1182 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-20-2020, 03:00 AM
  2. [SOLVED] Cycle through objects in userform with for loop
    By mason0567 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-16-2015, 06:31 PM
  3. [SOLVED] Until Loop cycle
    By arn0ldas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-05-2014, 04:35 PM
  4. [SOLVED] Cycle through each row in Column A in a for loop for specific text?
    By Hyflex in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-17-2013, 03:47 PM
  5. Loop cycle not copying correct cells
    By HDMI in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-23-2013, 10:53 AM
  6. cycle through n files
    By Rossella in forum Excel General
    Replies: 15
    Last Post: 04-14-2006, 03:20 PM
  7. [SOLVED] Cycle Excel Files Linking & Summing
    By David M C in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2006, 12:25 PM

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