+ Reply to Thread
Results 1 to 3 of 3

export columns from 3 excel files and send them to one file

  1. #1
    Registered User
    Join Date
    10-08-2011
    Location
    new zealand
    MS-Off Ver
    Excel 2003
    Posts
    2

    export columns from 3 excel files and send them to one file

    Hi guys
    I am dealing with survey data at the moment and i am interested in extracting data of 5 identical columns from 3 excel files and then aggregate them into one excel file.

    below is the code im working on, fairly new to VBA so my apologies if my code doesnt make sense to you.





    Sub extraction()

    Dim a As Range
    Dim r As Range
    Dim wbSource As Workbook
    Dim wbDestination As Workbook

    Dim cumrow As Long

    Set wbSource = Workbooks.Open("C:\Data extraction for Elieen\IVS_Trips.xlsx")
    Set wbDestination = Workbooks.Open("C:\Data extraction for Elieen\1.xlsx")

    cumrow = 0
    ActiveWorkbook.Select

    lastcol = Cells(1, Columns.Count).End(xlToLeft).Column
    lastrow = Cells(Rows.Count, lastcol).End(xlUp).Row
    Set r = Cells("AH1:AQ1").Resize(Rows.Count) ' This is your column


    ' Copy it to appropriate location on destination sheet
    wbDestination.Sheets(1).Cells("AH1:AQ1").Resize(Rows.Count) = a
    wbDestination.Sheets(1).Cells("AH1:AQ1").Resize(Rows.Count) = r
    cumrow = cumrow + lastrow

    End Sub




    thanks in advance for your help.

    Kind regards
    Iverson

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: export columns from 3 excel files and send them to one file

    Hello vba_iverson and welcome to the forum.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # at the top of your post window. For more information about these and other tags, found here
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Registered User
    Join Date
    10-08-2011
    Location
    new zealand
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: export columns from 3 excel files and send them to one file

    my apolgoies, will take a look at the forum rules now

+ 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