+ Reply to Thread
Results 1 to 22 of 22

Get data from diferent workbooks to a single workbook

  1. #1
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Get data from diferent workbooks to a single workbook

    Hi all
    I have a problem that if anyone could help me to solve i will be thank-full
    i have several workbooks in one folder with information regarding stocks of goods in different articles, these sheets have always the same name ( existencia ), and the information i need to " get" is allways in the same range(s) ( in yellow )
    i need to take the information that is in yelow from the diferent workbooks to a workbook called stock.
    I made an exemple of what is my target
    thanks

    attatched the exemple files
    Attached Files Attached Files
    Last edited by clixo; 10-22-2010 at 01:39 PM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: get data from diferent workbooks to a single workbook

    This will do it, just edit the fPath at the top of the macro to point the correct folder. This macro goes into the stock.xls file in a standard code module.
    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 10-22-2010 at 08:57 AM. Reason: code and workbook removed...see below
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: get data from diferent workbooks to a single workbook

    Hi Jerry, first of all Thanks for your help.
    I am testing it right now !
    Last edited by clixo; 10-22-2010 at 06:34 AM.

  4. #4
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: get data from diferent workbooks to a single workbook

    Hi again,
    It works perfectly.
    Just one other thing , if i only wanted to get positive values of stock what should i add to the macro ?
    Thanks

  5. #5
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: get data from diferent workbooks to a single workbook

    Your data isn't what it appears to be. Even filtering for values >0 still gets some rows that appear to be zero because it's only displaying zero. After the import is complete click on one of "zero" cells that still got imported and you'll see the value in the cell isn't actually zero. So you've got some problems with your data you'll have to resolve.

    I've edited the macro to filter and copy only values >0, perhaps you can safely change that to >2 and still get the proper results?
    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: get data from diferent workbooks to a single workbook

    I think so, i will make a few more trials and will report back ! , once again thanks for you time and patience !

  7. #7
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: get data from diferent workbooks to a single workbook

    It works ! , chaged to 0.5 and it runs very well.
    Thanks !

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Get data from diferent workbooks to a single workbook

    I'm glad I was able to help.

    Regarding your post here:
    http://www.excelforum.com/excel-prog...data-from.html

    1) It is customary to ask followup questions in the same thread, though your question is unique enough perhaps that's no biggie.

    2) I am concerned that you find it necessary to remove the authorship code lines from the macro especially before posting it again on the internet. That is very odd to see. Was the help given not sufficient to warrant leaving that part alone?

    Don't get me wrong, if you write your own macro(s) using snippets and techniques learned here, then of course, it's ultimately your work. But the only change you made was to adjust a number (like I instructed) and remove the crediting comments.

    Very odd to see. Especially when you then post the macro again somewhere else, in which case the source commentary is specifically appropriate, don't you think?

  9. #9
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Get data from diferent workbooks to a single workbook

    Perhaps he (or she) is expected to not be asking questions on the internet at work, in which case it seems quite reasonable to me. Since you're giving the code away anyway, why do you care (or indeed put your name to it in the first place), if I may ask?
    Remember what the dormouse said
    Feed your head

  10. #10
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Get data from diferent workbooks to a single workbook

    On all the various forums I frequent fully fleshed macros are quite often authored, while snippets are not.

    It's just as reasonable to leave them in. On code this complete, that is. If not left in at work, then definitely when posting back for more. It's the wee small things, I guess.

  11. #11
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Get data from diferent workbooks to a single workbook

    Quote Originally Posted by JBeaucaire View Post
    On all the various forums I frequent fully fleshed macros are quite often authored, while snippets are not.
    I guess we must move in different circles then.
    It's just as reasonable to leave them in.
    Again, if this is a work thing, I can totally understand why someone would not want to make it obvious that they did not actually write the code!

    At the end of the day, I guess I just don't see the point in worrying about it, unless someone is stealing something you charge for. Different strokes, though, and all that.

  12. #12
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Get data from diferent workbooks to a single workbook

    Quote Originally Posted by romperstomper View Post
    I guess we must move in different circles then.
    Nah, I can see you from here. I like that sweater.


    Again, if this is a work thing, I can totally understand why someone would not want to make it obvious that they did not actually write the code!
    We've already agreed on that...can only go by what is seen here, though.


    At the end of the day, I guess I just don't see the point in worrying about it, unless someone is stealing something you charge for. Different strokes, though, and all that.
    That's ok, too. Different strokes indeed. I hope you hear me saying I understand your comments, I don't agree, that's all.

  13. #13
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Get data from diferent workbooks to a single workbook

    Thanks - my Granny knitted it for me.

    As to the rest, I hear ya, and I do understand - we all have things that get under our skin, however niggling they may seem to others. I guess really all I was trying to say is that I've rarely seen any good come of expressing those frustrations, so now I just ignore people who annoy me (as much as I can bear to, anyway! )

  14. #14
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Get data from diferent workbooks to a single workbook

    Quote Originally Posted by romperstomper View Post
    So now I just ignore people who annoy me
    Will you start speaking to me again if I say sorry

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  15. #15
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Get data from diferent workbooks to a single workbook

    Only if you say you like my jumper.

  16. #16
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Get data from diferent workbooks to a single workbook

    Apologising is one thing but that's one of the worst crimes against fashion I've ever had the misfortune to witness.

    It suits you

    Dom

  17. #17
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Get data from diferent workbooks to a single workbook

    Good enough.

  18. #18
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: Get data from diferent workbooks to a single workbook

    The edit was not meant to arm anyone, i simply erase the lines in the top of the macro, i already edited the code and putted it back.

    i opened a new thread since the original one was solved, nevertheless , lesson learned !

    the code is like this at the moment :

    Please Login or Register  to view this content.

  19. #19
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Get data from diferent workbooks to a single workbook

    Heh, I gave up calling my stuff "final"...there's always some new little tweak or feature to add. Cheers.

  20. #20
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: Get data from diferent workbooks to a single workbook

    yes , its true ...its never final ....
    now i am checking some more details e want to add .... to rename the sheet with the actual date and some more small things that are now growing in my mind. but the main thing was the code you gave me ! without it ....
    once again Thanks

  21. #21
    Registered User
    Join Date
    09-14-2004
    Posts
    21

    Re: Get data from diferent workbooks to a single workbook

    missed to post the code for the 2 sub macros i inserted in the main code :

    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

  22. #22
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Get data from diferent workbooks to a single workbook

    Maybe this:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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