+ Reply to Thread
Results 1 to 7 of 7

Count the number of excel files in a folder with vba....

  1. #1
    Registered User
    Join Date
    04-27-2015
    Location
    Perth
    MS-Off Ver
    office 2010
    Posts
    76

    Count the number of excel files in a folder with vba....

    Hi,

    I receive +450 excel files everyday. All excel files have unique and fixed names. The problem is....I have to check manually if I got all files and no file is missing and it takes me a hell lot of time to check all of them one by one.

    An Example :- Suppose there are 100 files of the the names f1, f2, f3, f4, f5, f6.....................f97, f98, f99, f100. If four files are missing f6, f12, f55, f87.....then is it possible to write a program in vba that can check if these four files are missing and output the name of missing files in a separate worksheet (say sheet5) or display a message box with the name of missing files.

    Note :- All files are in the same folder.

  2. #2
    Forum Contributor kalbasiatka's Avatar
    Join Date
    02-27-2016
    Location
    Brest, Belarus
    MS-Off Ver
    2021
    Posts
    224

    Re: Count the number of excel files in a folder with vba....

    Hi!
    Show a few real file names
    To do it for me and help me it is 2 different things!
    Sorry for my english, blame Google translator

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Count the number of excel files in a folder with vba....

    Maybe (untested):

    Please Login or Register  to view this content.
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Count the number of excel files in a folder with vba....

    This prompts the user for the folder to check, the base file name, and the max sequential file number. The missing excel file list is placed on Sheet5 column A


    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  5. #5
    Registered User
    Join Date
    04-27-2015
    Location
    Perth
    MS-Off Ver
    office 2010
    Posts
    76

    Re: Count the number of excel files in a folder with vba....

    Hi alphafrog. Your code is working exactly what I want. This code solves my problem when I know the files name in advance.

    I have one more question. Sometimes I also receive excel files whose names I don't know in advance but file names are written in separate worksheet from where I compare them to the name of files given in folder.

    For example in sheet1 :-

    Cell(A1) = z
    Cell(A2) = z1
    Cell(A3) = z2
    cell(A4) = s2
    cell(A5) = s122
    cell(A6) = p6
    ......and so on

    Now I simply want that the vba checks every cell and see if the names(given in the cell) match to the names of the excel files given in a particular folder, if files are missing in the folder than it lists missing files in sheet7. If this is possible than it will be a great help.
    Last edited by mohit999; 08-07-2016 at 02:17 PM.

  6. #6
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Count the number of excel files in a folder with vba....

    Quote Originally Posted by mohit999 View Post

    Now I simply want that the vba checks every cell and see if the names(given in the cell) match to the names of the excel files given in a particular folder, if files are missing in the folder than it lists missing files in sheet7. If this is possible than it will be a great help.
    You're welcome.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-27-2015
    Location
    Perth
    MS-Off Ver
    office 2010
    Posts
    76

    Re: Count the number of excel files in a folder with vba....

    you are a genius frog.I can't thank you enough. Problem and thread is solved.

+ 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. Count number of rows of all files in folder
    By resulgul in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-07-2023, 01:06 AM
  2. Replies: 4
    Last Post: 04-03-2014, 05:19 PM
  3. [SOLVED] Can Excel do calculations ie count number of .xlsx files in a specific folder on pc
    By blacktie in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-19-2013, 06:13 AM
  4. Replies: 2
    Last Post: 11-12-2013, 02:11 AM
  5. Replies: 2
    Last Post: 06-01-2012, 07:40 AM
  6. count the number of files in a specified folder
    By bambino86 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-04-2009, 12:55 PM
  7. Count files in folder
    By gmunro in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2005, 06:06 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