+ Reply to Thread
Results 1 to 10 of 10

Get 3 cell values from all the excel files located in folder & make table in master file

  1. #1
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Get 3 cell values from all the excel files located in folder & make table in master file

    Hello VBA Experts,
    I have very limited understanding of VBA but i studied in uni about C, Java, php etc to tweak little bit of VBA.

    My intention is, i got one folder full of Excel invoices generated by one Master Excel File. I added another sheet and this master sheet need to make table with three columns "
    Date|Invoice No| Invoice Amount

    My VBA code need to work on this sheet and fetches these three cell values from each excel sheet of different invoices.xls
    I found one code on youtube, that works on something similar but my efforts are fruitless with partial success.
    But looks like my limited knowledge will take forever to solve it, will appreciate if someone can help me on this, many thanks.

    Ron



    Please Login or Register  to view this content.
    Last edited by ronin21; 04-18-2012 at 07:16 AM.

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Do attention, you didn't do as provided in forum rules "Use code tags around code", please
    edit your code, select code and click on '#' icon so text will be inserted in correct tag.

    See attached file where I modified macro:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    Attached Files Attached Files
    Last edited by antoka05; 04-18-2012 at 05:21 AM.

  3. #3
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Thanks Antonio, for quick repy and beautiful code, it worked but after working through all the four invoices it crashed instead of stopping gracefully.
    another problem that i faced earlier was when it pastes data back to master sheet "sum"
    it writes three values in rows instead of placing them in columns,

    Date | Invoice No | Invoice Amount

    231231231 ' firs invoice no
    12/04/2012 'First invoice date
    $21231 ' first invoice amount as this is how they looks in my invoice ....G column from top to bottom.
    231231231
    12/04/2012
    $21231231231231
    12/04/2012
    $21231
    231231231
    12/04/2012
    $21231

    but i am after this list
    Date | Invoice No | Invoice Amount
    12/04/2012 231231231 $21231

    I really don't know how to manipulate data after copying from each invoice and assign them to master sheet "sum"


    Regards

    Ron

  4. #4
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Ron, please modify your first post, select code and click on '#' icon to put code tags around code else I can't continue to answer to you!

    I modified code, I hope now it's as you need.
    Regards,
    Antonio
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Antonio, my apology regarding code presentation, i fixed it ....
    Right cell copied and pasted at right place, excellent work.. appreciate your time and efforts.

    Two problems happens...little hiccups
    1. All invoices gets reported but program ends with error please see first image for error code.. i guess it tries attempt on master sheet and ends when it couldnt find the "sheet1"
    2. Invoice amount is formula and it copies formula not the value!!

    Regards

    Ron
    Attached Images Attached Images
    Last edited by ronin21; 04-18-2012 at 07:40 AM.

  6. #6
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    I modified my macro to fix formula problem but I don't know how to help you with error because i don't know where it crashes... I tested it and it works fine with my test files.

    Regards,
    Antonio
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Beautiful, very precise and sleek... ur a legend for saving me heaps of time...
    I think this crashing problem is due to ~$ temp file generated files for the master.

    I am trying to add something on loop

    Regards

  8. #8
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Antonio, i placed MSGbox to show up file name each time loops through different invoice file while fetching three cells value.
    it encounters Master file and deals it gracefully but next loops through " ~$Tax Invoice 14 April 12.xlsm" and crashes. with error msg window i pasted earlier for your attention.

    Thanks

    Regards



    Quote Originally Posted by antoka05 View Post
    I modified my macro to fix formula problem but I don't know how to help you with error because i don't know where it crashes... I tested it and it works fine with my test files.

    Regards,
    Antonio
    Last edited by ronin21; 04-18-2012 at 08:25 AM.

  9. #9
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    I modified previous code from:
    Please Login or Register  to view this content.
    to:
    Please Login or Register  to view this content.
    Regards,
    Antonio
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    04-18-2012
    Location
    Brisbane Australia
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Get 3 cell values from all the excel files located in folder & make table in master fi

    Great work, works like charm.....good on ya mate...u r genius ...
    Thanks a lot...

    Ron

+ 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