+ Reply to Thread
Results 1 to 19 of 19

Batch Processing Excel Workbooks

  1. #1
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Batch Processing Excel Workbooks

    Hi all! I’ve taken on some voluntary work for an animal trust and just need some help (if possible) for the second part of my excel problem.

    Part one of removing any rows where to totals equal zero or the rows are blanks is complete. See thread link below:

    http://www.excelforum.com/excel-prog...ml#post4124298

    I have around 60 or so excel workbooks. Each workbook has 9 worksheets named March, April, May etc through to November.

    In column BR of each worksheet I have a totals column, cell type is set to general. Each cell concerned contains =SUM. For ex. =SUM(BP13:BQ13). If the cells in this totals column equal the integer zero only (not 3500, 2440 etc) or is blank I would like the whole row deleted. I would like to do the above from row 13 to 350 inclusive.

    I know need to apply the above code (see link) so that it executes on around 60 or so workbooks in the same directory.

    Any help would be much appreciated.

    Jules

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    A possibility can be to put all macros in the same file: Toolbox
    The file must be in the same folder as the files to treat
    Please Login or Register  to view this content.
    Attached Files Attached Files
    - Battle without fear gives no glory - Just try

  3. #3
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    Hi. I've created 3 copies of the original file to test the above. They're all in the same directory. Open up one of the workbooks and insert new module, paste in your code and save and close the visual basic editor. I then alt+f8 and select the macro TreatAllFile but it is erroring giving the message:

    runtime error 1004
    method 'range' of object '_global' failed

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    Well, the way to do is this one:

    In the folder where are the files put the file Toolbox file
    Don't do anything on the files
    In file Toolbox clic the button = Launch Full treatment or launch the macro TreatAllfile
    It can takes some time

  5. #5
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    Hi, I can't download to this machine the file you attached, and I don't have the toolbox as I'm using 2003 excel.

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    " I'm using 2003 excel. "
    OK see the file attached
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    Hi I can't download to this machine is it not possible to paste any code into the thread?

    thank you

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    OK
    Prepare a file that you call ToolBox
    Record a macro in this file and change the contains of this macro by the code sent at the beginning.
    Put this file in the same folder where are the files to treat.
    When the ToolBox is open launch the macro

  9. #9
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    Hi I created a new excel workbook and renamed it ToolBox.xls

    then inserted a new module and pasted in the code you supplied saved and closed the book.

    re-opened it and ran the macro but it's producing the error:

    runtime error 1004
    method 'range' of object '_global' failed

  10. #10
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    What is the statement involved?

  11. #11
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    sorry I dont understand what you mean by statement?

  12. #12
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    if I go debug it's highlighting the line:

    Range("WkPath") = WkPath

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,363

    Re: Batch Processing Excel Workbooks

    Did you create the Named Range WkPath in Cell C2 ?

  14. #14
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    no sorry I had no idea I was suppose to do that.

    Ok in the ToolBox.xls file I created I have selected cell C2 and then in the cell name box called that cell WkPath hope that's right

    It's now giving the error:

    The macro 'ToolBox.xls!Treat' cannot be found

    thanks

  15. #15
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    OK I got it.
    Delete statement
    Please Login or Register  to view this content.
    It was used to display the working path in the file

  16. #16
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    In the file Toolbox did you put the macro Treat
    Here the set of macros to put in the file Toolbox
    Please Login or Register  to view this content.

  17. #17
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    By the way to finish the presentation.
    In file Toolbox from row 5 and column "B" is done the list of files treated
    See next statements: you can delete them if you don' t want
    If you keep them, take care that the name you create ( WkPath ) is not in this range.

    Please Login or Register  to view this content.

  18. #18
    Registered User
    Join Date
    07-05-2015
    Location
    England
    MS-Off Ver
    2003
    Posts
    27

    Re: Batch Processing Excel Workbooks

    It seems to have worked : )

    I will check it manually later today on two of the workbooks just to be sure.

    I'm not worried about it displaying the files treated in the workbook file, it's actually good to see this there.

    Thank you so much I will get back to you just to confirm

    wonderful!!!

  19. #19
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Batch Processing Excel Workbooks

    So just to review what's happen:
    It did not work immediately, because it was not possible to use the file sent
    All macros are merged in the same file like a tool box
    All files in the same folder are treated if there is sheets named "March,April,May,June,July,August,September,October,November"
    In file Toolbox (you could used another name) in the active sheet:
    is displayed the files treated
    is displayed the path in cell named "WkPath"
    It can takes some time to do the full treatment, because all files are opened, treated, recorded and closed

+ 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. Batch processing excel macro in Mac OS X
    By adithyaroshan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2015, 02:31 PM
  2. Help modifying a batch processing Macro
    By a_stansbury in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-15-2014, 02:44 PM
  3. Open Batch File For Processing
    By Chuckles123 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-15-2005, 09:05 AM
  4. excel batch processing
    By anwarbham in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2005, 12:09 PM
  5. [SOLVED] how to batch processing excel worksheet modifications?
    By neptune in forum Excel General
    Replies: 4
    Last Post: 01-13-2005, 05: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