+ Reply to Thread
Results 1 to 20 of 20

Open another File and Capture some Columns

  1. #1
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Open another File and Capture some Columns

    Hi,
    I would like to seek help on some Macro coding.
    I need a Macro that will open another Excel File (for this example i created a dummy file called "dummy.xls").
    However this Excel file contains more data and some columns I dont really need.
    For this example I only need columns A,G,J,K,L,M,N,O,P,Q,R

    Can you guys help me create a Macro where in it will only pull data's from the mentioned column?
    Kindly advise, really need this one. As always

    I have enclosed two documents.
    One is my Dummy data (dummy.xls)
    The other one is my MacroLab (where data will be placed, i added the data as how it should look like when data is collected)

    Hope you guys can help.
    Thank you very much.
    Attached Files Attached Files
    Last edited by Andrew.Trevayne; 12-27-2010 at 12:17 AM.

  2. #2
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Hope you guys can help

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew.Trevayne

    Do you want to "pick" a source file to be opened or should it be hard coded?

    Do you want to "pick" a target file or should it be hard coded; does it need to be created?

    Do (or will) both the source file and the target file exist in the same directory?

    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Hi John,
    Thank you for your reply. If I could get the chance to pick a source file would be better.
    And maybe I can dump all source file on C:\Temp and choose from there.
    All my raw data will have the same structure. But I only need those in column A,G,J,K,L,M,N,O,P,Q,R
    The target file should be the same as where I will run my Macro. In this case the Macrolab.xls
    I hope you could help me. Thank you in advance.

  5. #5
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    I should think one of us can help. It's late here but I'll check back in the AM. If your issue isn't resolved, I'll look into it.

    John

  6. #6
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Hi John,
    Thank you very much. I'm looking forward to your help.

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    The attached file includes this code
    Please Login or Register  to view this content.
    You'll need to change the line that's underlined to the path and folder name of your raw data.

    Let me know of issues.

    John
    Attached Files Attached Files

  8. #8
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Wow! John this is perfect. You're a genenius.
    Thank you so much for this.
    Just wanted to add and I hope Im not asking much.
    During the import, is it possible that the contents on columns L to Z wont be cleared?
    Cause I have some formulas on those columns and they get cleared during transfer.
    About the formatting, Is there away to retain the original format of Macrolab Excel sheet after the data has been copied?
    Thanks again John for being helpful. Appreciate it.

    -Andr

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    Didn't see any data (or formulas) in
    columns L to Z
    If you'll attach a file that has "real" data, I'll look at it.

    John

  10. #10
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Hi again John,
    I actually have formulas in there but I didn't put anymore.
    The formula is actually going to calculate some columns on the imported data. ^^
    I have attached the Macrolab so you will see the formula as well.
    Thanks again for all your work.

    -Andr
    Attached Files Attached Files

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    I'm not certain what you're after. See if this works for you.
    Please Login or Register  to view this content.
    John

  12. #12
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Macro to Open another File and Capture some Columns

    Hi John,
    Sorry for the reply. Been a bit busy on the Christmas Holidays.
    Anyways I tried using the modified Macro and I'm surprised to see that you embedded the formula in there.
    This is enhancement for me and Thanks so much.

    Any ideas on the formatting on this? What can we add so the target worksheet does not copy the formatting from the source?
    Maybe remove those background fill and set the headers(A4 to L4) to bold?

    Thanks so much for all your help, hope you enjoy this Holiday season.

    Andr

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    I'll be happy to accommodate this if I can
    Any ideas on the formatting on this? What can we add so the target worksheet does not copy the formatting from the source?
    Maybe remove those background fill and set the headers(A4 to L4) to bold?
    I added the background fill because that's what your sample file looked like. As it is, I now have no idea what you want...SHOW ME. Attach a file that
    has "real" data
    (before and after) so I can see what it is you're are looking for. Attach a source file (with it's actual formatting). Attach a final file (with it's formatting AND formulas). I'm fairly confident we can duplicate what you want. I simply don't know for sure what that is.

    John

  14. #14
    Registered User
    Join Date
    10-13-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: Macro to Open another File and Capture some Columns

    Hi John,
    Thanks so much for your swift response.
    I have attached a live source data. Some of the fields in it contains "Yellow" fill.
    If this formatting will be carried over on my target sheet, it would not look very nice hehe!
    Actually this are just cosmetics issues.
    But if can be done would be great.


    I have attached Documents, My Source (Source.Xls), Our Worklab (MacroLab.xls), Desired Display (Desired Output.xls)
    .
    Currently our Macrolab is working perfectly as it should. If we could somehow format it and appear as my Desired Display will be fantastic.
    Sorry for giving you too much trouble on this. You helped me more than enough.
    Attached Files Attached Files

  15. #15
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Andrew

    I'll look at it tonight. May get back to you soon but probably in the AM.

    John

    PS: To whom am I talking...Andrew or Vincent????

  16. #16
    Registered User
    Join Date
    10-13-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: Macro to Open another File and Capture some Columns

    Quote Originally Posted by jaslake View Post
    Hi Andrew

    I'll look at it tonight. May get back to you soon but probably in the AM.

    John

    PS: To whom am I talking...Andrew or Vincent????
    Hi John,
    Sorry I am working with my colleague on this. We are both learning Macro and I was also looking into this. Hope you could help us.
    Many thanks again.

  17. #17
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to Open another File and Capture some Columns

    Hi Vincent/Andrew

    Try this code
    Please Login or Register  to view this content.
    I HOPE this is a work project and not a School assignment!!! If it's not, let me know of issues.

    John

  18. #18
    Registered User
    Join Date
    10-13-2010
    Location
    Singapore
    MS-Off Ver
    Excel 2003
    Posts
    82

    Re: Macro to Open another File and Capture some Columns

    Hey John,
    Thank you so much from Both of us. You have been very accomodating.
    This is just fantastic.

    Enjoy the Holidays.

    Cheers,
    Vincent/Andrew

  19. #19
    Forum Contributor
    Join Date
    11-02-2010
    Location
    Philippines
    MS-Off Ver
    Excel 2003
    Posts
    353

    Re: Very Satisfied: Macro to Open another File and Capture some Columns

    Thank you so much John. You're great!

  20. #20
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Very Satisfied: Macro to Open another File and Capture some Columns

    Vincent/Andrew

    Merry Christmas and a Healthy, Happy New Year.

    John

+ 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