Hi! All,
Please find a macro below. All I want is to edit this macro so that it runs on all the files in a particular folder
Please Login or Register to view this content.
Hi! All,
Please find a macro below. All I want is to edit this macro so that it runs on all the files in a particular folder
Please Login or Register to view this content.
Last edited by JBeaucaire; 06-09-2013 at 05:55 PM. Reason: Added CODE tags, as per Forum Rules. Take a moment to read the Forum Rules in the menu bar above. Thanks.
can anyone edit the above mentioned macro so that it runs on all the files in a particular folder
Hi, rohit43,
you could have edited the originla post instead of reposting.
Maybe like this (untested)
But I strongly doubt that you have a lot of workbooks with a sheet named Jun8 in that folder.Please Login or Register to view this content.
Ciao,
Holger
Use Code-Tags for showing your code: [code] Your Code here [/code]
Please mark your question Solved if there has been offered a solution that works fine for you
Hi! Holger,
I am sorry to say but this didn't work. I am not very good with macros. The one posted was actually recorded by me. Can you edit the same macro so that it automatically runs on all the workbooks in a particular folder.
All the workbooks in the folder are exactly the same with different workbook names. And the the workbook contains same sheets with same sheet names. The comments on each workbook are different as they are filled by different users.
Hi, rohit43,
Could you be a bit more specific about what didnīt work? Any error messages put up, error numbers shown, files not opening, no new sheets entered?I am sorry to say but this didn't work.
Have you tried your macro on more than one file with success?Can you edit the same macro so that it automatically runs on all the workbooks in a particular folder.
I wouldnīt rewrite all the code (since my efforts didnīt work) but use a wrapper for opening and closing the files and use the existing macro to do the work (which could need a good boost of work):
Ciao,Please Login or Register to view this content.
Holger
Hi! Holger,
No new sheets were enteredCould you be a bit more specific about what didnīt work?
Yes it works on all other worksheets in that folder if I run it seperately on each one of them.Have you tried your macro on more than one file with success?
As I said earlier, I am not good with macros. I can only record macros and run a given macro. I am not able to understand the macro that you have given me. I don't know if I need to add this to my macro or run it as a seperate one.
Is it possible for you to give me some commands which can be added in the beginning or end of my recorded macro so that it runs on the rest of the files as well. I am also okay to keep the other files opened at the same time if that helps.
thanks so much for all your efforts and pain.
Hi, rohit43,
I checked my code on one sample workbook, sheets were inserted there as expected, no error messages - after I corrected a mistake which caused a run-time error (funny it didnīt show up on your system).
must readPlease Login or Register to view this content.
Please find the workbook I used for this as an attachment.Please Login or Register to view this content.
Execution is quite simple: look at the directory which is given, create a collection of all workbooks that meet the criteria in that directory, loop through all of them and insert the given number of worksheets as a copy of the one which is stated as master, clear the contents, rename them according to the array, close the workbook with saving the changes, loop until no workbook is left over.
Ciao,
Holger
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks