Closed Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23

Thread: Excel (take worksheet from 2 files?)

  1. #1
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Excel (take worksheet from 2 files?)

    Hi All,

    Is it possible to create a macro or something else that would take the first tab from 2 different files and put them into one file?

    ex: file 1 (has 3 worksheet tabs)..I only want the data on tab 1
    same for file 2...
    create new file with both tabs from file 1 and file 2

    Thanks!

  2. #2
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    using macro doesn't work...it just opens 2 new files...each one containing only the one. i don't think this is possible.

  3. #3
    I like Data Cubes too... Lauramc has a spectacular aura about Lauramc has a spectacular aura about Lauramc's Avatar
    Join Date
    Mar 2008
    Location
    Far Far Away
    Posts
    387
    Real Name
    Laura
    Rep Power
    5

    You can link data from other workbooks. I usually don't recommend this, but here is how it might be done:

    Note: Both sheets need to be the same format and have the same column names and number of columns.

    1. Open both workbooks
    2. Find where you want data to be placed and place your cursor in that location.
    3. Type = then go to the spreadsheet that has the data you want and select that first cell (it should be in the same relative position as the cell you have selected for pasting the data).
    4. Go back to the first worksheet. You should now see somthing like =[Book1]Sheet1!$A$1 in that cell that you started from.
    5. Remove the dollar signs in the link example =[Book1]Sheet1!$A$1 becomes =[Book1]Sheet1!A1.
    6. Select that first cell and drag the formula across the columns and down the rows for however long it takes to reference all the data from the first sheet.

    Let me know if you have any questions or need examples.
    "The Enrichment Center is required to remind you that first you will be baked, then there will be cake." - GLaDOS

  4. #4
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hi Laura,

    Gave that a try but I need something different....

    because every time I take data from these 2 files, it means each time the number of records from each will be different.

    I think I will be forced to use copy worksheet from one to the other so both worksheets are in same file...then I guess I'll just copy paste. I'll try to give example of what I'm doing...just thought if i could create a macro and attach to button so it can be done dynamically instead of manually.

    Thanks!

  5. #5
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    i think it can be done. attach a copy of the 2 excel sheets and i'll see what i can do.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  6. #6
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Okie dokies....attached.

    Thank you for checking it out....

    Each time File 1 and File 2 will contain a different amt of rows/data.

    Final is final outcome with notes.
    Attached Files

  7. #7
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    This excel file has a macro in it. You can put this on an on-click button if you choose. You will have to change the location of your files and the names of the two files that you need to open and copy from. But this should get you going.

    I got the macro to copy data from two files and to format as numbers. The rest, of your notes, I'm not sure on. We can talk about this later.
    Attached Files
    Last edited by mehere; February 16th, 2009 at 08:28 PM.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  8. #8
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hi Mehere

    Ok...trying to get it going but getting an error.

    Run time error '9'
    Subscript out of range

    then point to line below:

    Windows("Final_Template").Activate

    I saved the Final_Template under the same directory as the other files. Right now, It's opening up file1 and copying but then the error appears so nothing gets put on the Final_Template. Something I'm doing wrong?

    Thankies!

  9. #9
    Super Sarcasm Mistress mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere is a glorious beacon of light mehere's Avatar
    Join Date
    Mar 2008
    Location
    Wide Awake In Dreamland
    Posts
    830
    Rep Power
    8

    did you rename the file? do you know how to step through a macro? did you make the changes in the macro for directory and file names? i just ran it again and it works with no problems.
    Quote of the Month:
    INSIGHT: When the going gets tough, the tough get going. The smart left a long time ago.

    Questions to Ponder:
    Are people more violently opposed to fur rather than leather because it's much easier to harass rich women than motorcycle gangs?

    iif([sarcasm]=true,iif([you have to ask]=true,"didn't work","ha ha ha"),"not sarcasm")
    copyright © 2008 sbenj69

    Sarchasm: The gulf between the author of sarcastic wit and the person who doesn't get it.

  10. #10
    Barn Legend Rebelle will become famous soon enough Rebelle's Avatar
    Join Date
    Mar 2008
    Posts
    1,522
    Rep Power
    5

    Hi Mehere,

    I haven't really stepped thru before but I went to Tools, Macro, select it, and clicked Edit. In the edit (visual basic edit) I changed directory and the file names to match mine. Maybe it's my file names...let me shorten them and try again...brb.

Closed Thread
Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Tip for Reports Exported to Excel
    By Lauramc in forum SQL Server Reporting Services Help
    Replies: 0
    Last Post: January 13th, 2009, 10:09 PM
  2. From excel to database/web app
    By Rebelle in forum Database Design Help
    Replies: 7
    Last Post: July 10th, 2008, 02:36 PM
  3. Dynamically Reference Worksheet Cell/Range
    By BLaaaaaaaaaarche in forum Microsoft Office
    Replies: 2
    Last Post: June 18th, 2008, 04:59 PM
  4. Excel question
    By Rebelle in forum Microsoft Office
    Replies: 11
    Last Post: May 27th, 2008, 08:22 PM
  5. Retrieving Web Data using Excel
    By mehere in forum Microsoft Office
    Replies: 13
    Last Post: May 22nd, 2008, 04:14 PM

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

SEO by vBSEO