Hello John,
Thanks, I downloaded the file successfully. I will let you know what I find.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thanks. I don't envy you; there's a lot of code in there, and even I get lost going through it sometimes. I hope you can find an error I've made, but don't wear yourself out; it works well, just sometimes it gets annoying with it's pushiness.
Hi John,
I had a quick look and noticed that the code is very redundant since you are trying to open a set of workbooks in a specific order. You should be able to set up these file names into an array and loop through them instead of repeating code. It won't resolve the speed issue you are having but it might be a start so that people (including yourself) can easily read and make changes to the code.
Here's an example modified from a post by JBeaupcaire:
You can also modify this to keep the file names in a worksheet instead of hard-coding it into the vba code. For future purposes that would make sense since the individuals (or file names) may change over time.Option Explicit Sub Array_WB_WS() Dim wbARR As Variant, wsARR As Variant Dim wbDATA As Workbook Dim fPath As String, a As Integer 'remember the final \ in this string, the path to all the files fPath = "C:\2010\MyFiles\" 'an array of the non-changing sheet names, in a specific order wbARR = Array("Excel Workbook_1.xls", _ "Excel Workbook_2.xls", _ "Excel Workbook_3.xls", _ "Excel Workbook_4.xls", _ "Excel Workbook_5.xls") 'an array of the destination sheet tab names, in the SAME order as above (not currently used in example) wsARR = Array("Sheet1", "Sheet2", "Sheet3") 'Loop through each item in the wbARR, open file, copy data to matching sheet For a = LBound(wbARR) To UBound(wbARR) Set wbDATA = Workbooks.Open(fPath & wbARR(a)) With wbDATA.Sheets(1) ' More code here End With wbDATA.Close False Next a End Sub
Hope this helps.
abousetta
Please consider:
Thanking those who helped you. Click the star icon in the lower left part of the contributor's post and add Reputation.
Cleaning up when you're done. Mark your thread [SOLVED] if you received your answer.
Hi John
I believe you're owed an apology...so, apologies from me if not from the Forum. You and I have worked on several projects together and I find your willingness to explore and learn to be refreshing.
The European approach to things can be somewhat "put offish". I find Poster #10 to be extremely intelligent when it comes to things VBA...albiet...the code he provides is often indecipherable to me. Perhaps it is to you.
Self taught is what I am...I don't find it so bad...I learn new things every day from the likes of Mr. Ross and many others such as him who are willing to give their time and share their knowledge with us "self taught and still learning". My wish is that Mr. Ross were in my time zone.
Keep exploring...learning...asking questions. Soon, I'll be asking you questions.
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Hello Jomili,
My suspicion lies with the pivot table routines. I don't mix pivot tables and VBA code. They don't play well together. I am not sure yet how we can test this out to either validate or disprove it.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
I'm at home for the weekend, so have very limited time/access to the forum, and no access to Excel I'll respond more fully on Monday.
Abousetta, thanks for the code on using the array. I thought there should be a way to reduce the redundancies, but had no idea how to approach it. Thanks for pointing the way.
Jaslake, thanks for the encouragement. No one owes me an apology; I come here looking for help, and am grateful for any help I get, no matter how it's delivered. But thank you for offering an apology anyway. I'm certainly grateful for all the time and effort the members of this forum put into helping folks like me. I hope to be skilled enough to be able to answer your questions at some point.
Leath, I don't much like pivot tables either, but don't know another way to do it. The source workbooks I start with are only pivot tables; the source data is locked away from me. Once I get that source data, the only method I know of to manipulate and condense it all is via pivots. If you know of another way, I'm eager to learn.
Have a great weekend!
John
Never got a definitive answer, so guess I'll just have to live with it. Thanks to everyone for trying.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks