+ Reply to Thread
Results 1 to 4 of 4

Macro to run in all workbooks with condition

  1. #1
    Registered User
    Join Date
    02-09-2015
    Location
    Sialkot, Pakistan
    MS-Off Ver
    2007
    Posts
    20

    Question Macro to run in all workbooks with condition

    Hello friends,
    I am an accountant in a firm which deals mostly in Installment sales of motorcycles. Apart from manual book keeping
    I keep all of my data related to installment sales saved in excel files. For this purpose I use a template which is very much
    like a an invoice but also shows due dates, payment dates, amount of installment paid & remaining balance of the customer.
    I am currently managing sales data of 4 of our branches. The folders I have are Branch-1, Branch-2, Branch-3 & Branch-4.
    Each of these folders contains sub folders named according to year of sales like from year 2006 to 2015 & has 12 workbooks each (Jan 2006.xls, Feb 2006.xls & so on till March 2015.xls in folder named 2015). Each of these
    workbooks has different numbers of worksheets named according to the account number assigned to the customer.

    I am searching for a solution to run a macro with certain conditions in all of my workbooks in a folder. The macro I use
    is a simple code which goes through all worksheets in a workbook, extracts data from certain cells in all worksheets &
    creates a summary in a worksheet named ‘Summary’ by pasting the data row wise. This is the macro:

    Please Login or Register  to view this content.
    I run this code in all of my workbooks, which is a bit time consuming. I have to custom format summary sheet by adding
    header, headings in column, set the desired column width etc. Then I have to copy all sheet & paste in a another
    work book in order to complete master summary for any branch so that I have complete customer info from year
    2006 to 2015 in either branches. Apart from master summary sheet, I have to prepare two more sheets, one which
    shows customers with remaining balance & the other which shows remaining balance with a condition i.e. H13 has data
    more than 0 (H13>0) in omitting any account with H13=0.

    I am looking for a macro or may be 3 macros (considering 2 conditions I mentioned above) that runs through all of my
    workbooks (excluding a sheet named Summary which is in every workbook) branch wise, collect data from cells,
    paste into one master sheet row wise with column headings, sets column width according to space occupied by text in
    a cell, with the main header as Branch folder name & shows date - time when summary is created. I possess a very
    limited expertise on excel & a will to learn more therefore any kind of assistance will be highly appreciated.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,525

    Re: Macro to run in all workbooks with condition

    This the code to loop through a folder, edit the actions for when the code opens the workbook.

    http://www.xlorate.com/vba-examples....rough%20Folder
    Last edited by davesexcel; 03-01-2015 at 07:54 AM.

  3. #3
    Registered User
    Join Date
    02-09-2015
    Location
    Sialkot, Pakistan
    MS-Off Ver
    2007
    Posts
    20

    Re: Macro to run in all workbooks with condition

    Hello davesexcel,
    I tried the code but it doesnot do anything. I have changed the folder location in the code but after executing nothing happens..

  4. #4
    Registered User
    Join Date
    02-09-2015
    Location
    Sialkot, Pakistan
    MS-Off Ver
    2007
    Posts
    20

    Question Re: Macro to run in all workbooks with condition

    I am attaching files for better understanding of my requirement.

    February 2014.xls
    March 2014.xls
    Master_Branch_01.xlsx

    The first 2 files are example files from Branch 1 folder named 2014. The 3rd file is Master file i.e. summary of two example files above.

+ 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. Copy between workbooks with a condition
    By jpx72 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 09-26-2014, 08:38 AM
  2. [SOLVED] Copy Row data with condition and paste in new workbooks
    By tdugga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2013, 03:41 PM
  3. [SOLVED] Macro to copy row data based on a condition from several workbooks.
    By Ilikeideas in forum Excel Programming / VBA / Macros
    Replies: 42
    Last Post: 04-01-2013, 04:09 AM
  4. [SOLVED] Closing VBA - condition: number of open workbooks
    By MitchelDZ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-12-2012, 07:24 AM
  5. check if condition is true in closed workbooks
    By aravindhan_31 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2009, 03:29 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