+ Reply to Thread
Results 1 to 7 of 7

VBA loop through all the files in the folder and count the used rows

  1. #1
    Registered User
    Join Date
    08-13-2016
    Location
    india
    MS-Off Ver
    2010
    Posts
    61

    VBA loop through all the files in the folder and count the used rows

    Looking for a specific solution trough VBA, We have multiple excel workbooks in a folder, Now we need to get the count from all of the workbooks individually (each workbook has mutiple sheets in them, but need the count only from sheet with name "Consolidated" from all the workbooks in the folder). The count should do minus 1 to ignore header count. Also folder selection option needs to be included. The out put file should give the file name and count of used rows.

    Note: file name varies daily as it includes date in it, for example the file names are like
    Daily Monitor Check 20160701
    Daily Monitor Check 20160702
    Daily Monitor Check 20160703

  2. #2
    Registered User
    Join Date
    08-13-2016
    Location
    india
    MS-Off Ver
    2010
    Posts
    61

    Lightbulb Re: VBA loop through all the files in the folder and count the used rows

    somebody from members please help on this.

  3. #3
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: VBA loop through all the files in the folder and count the used rows

    Surely just a case of using DIR to get a list of files, opening each workbook in turn and getting the number of rows if the workbook should contain the sheet "Consolidated"...?

    All very basic VBA stuff - any basic search ("vba list files in folder") will get you the outline code you need.

  4. #4
    Registered User
    Join Date
    08-13-2016
    Location
    india
    MS-Off Ver
    2010
    Posts
    61

    Re: VBA loop through all the files in the folder and count the used rows

    Thanks cytop, Got the codes online, however two issues I have noticed
    1. The output sheet is coping column B from source wrkbook content to output sheet column B which is not needed. Please amend this in codes, as we just need file name and used rows count.
    2. Count is giving total count minus one. We need exact count of used rows minus headers reference column A in source workbook.
    3. Please add folder browse option in VBA, if we can to browse the folder and then execute the macro.

    Please help in amending these two in codes to remove column b from output sheet and to get exact count, Iam very new to VBA, coould not get the correct line to amend, so please help. Attached workbook contains the VBA code.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    08-13-2016
    Location
    india
    MS-Off Ver
    2010
    Posts
    61

    Re: VBA loop through all the files in the folder and count the used rows

    Somebody, Please help in amending the code.

  6. #6
    Valued Forum Contributor
    Join Date
    03-24-2014
    Location
    England
    MS-Off Ver
    Excel 2003 - 2016
    Posts
    575

    Re: VBA loop through all the files in the folder and count the used rows

    Tip: You'll get way more replies if it looks like you've made an effort and are trying to learn how to understand the code so you can edit it yourself rather than just asking for someone to do your work for you with no effort required on your part.

  7. #7
    Registered User
    Join Date
    08-13-2016
    Location
    india
    MS-Off Ver
    2010
    Posts
    61

    Re: VBA loop through all the files in the folder and count the used rows

    Thanks for the Tip, agree with you.

+ 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: 2
    Last Post: 02-29-2016, 03:05 PM
  3. Choose a Folder and Loop a Sub for all files in the chosen folder
    By smartbuyer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-11-2016, 10:57 PM
  4. [SOLVED] Choose a folder and loop through all files in the chosen folder
    By smartbuyer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2016, 11:19 PM
  5. [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
  6. Replies: 12
    Last Post: 03-09-2015, 05:52 PM
  7. Replies: 2
    Last Post: 11-12-2013, 02:11 AM

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