+ Reply to Thread
Results 1 to 2 of 2

need help for copying among workbooks

  1. #1
    snow
    Guest

    need help for copying among workbooks

    Hello everyone, these are the facts:
    I need to copy data from some columns of sheet1 of workbook1 to sheet2
    of workbook5
    then do the same thing (sequentially) for workbook 2,3,4 , just
    copying their A-J columns to sheet2 of workbook5...and the columns
    from WB2,3,4 need to be pasted in the first empty column of sheet2 of
    WB5

    I also need to be able to select (browsing in my hard disk) the file
    representing workbook5.

    I think a way is to define a macro for WB 1,2,3,4 that allows me to
    select the column I want to copy and paste and put them in the first
    empty column of sheet2 of WB5...

    really hope sone can help me...(


  2. #2
    Tom Ogilvy
    Guest

    Re: need help for copying among workbooks

    Sub CopyBooks1234()
    Dim sh1 as Worksheet, sh2 as Worksheet
    Dim sh3 as Worksheet, sh4 as Worksheet
    Dim sh5 as Worksheet, fName as Variant
    dim bk5 as Workbook, rng as Range
    fName = Application.GetOpenfileName()
    if fName = False then exit sub
    set bk5 = workbooks.Open(fName)

    set sh1 = workbooks("Workbooks1.xls").Worksheets("Sheet1")
    set sh2 = workbooks("Workbooks2.xls").Worksheets("Sheet1")
    set sh3 = workbooks("Workbooks3.xls").Worksheets("Sheet1")
    set sh4 = workbooks("Workbooks4.xls").Worksheets('Sheet1")
    set sh5 = bk5.Worksheets(2)
    set rng = sh5.cells(1,"IV").End(xltoLeft)(1,2)
    sh1.columns(1).Resize(10).Copy destination:=rng
    sh2.columns(1).Resize(10).Copy destination:=rng.Offset(0,10)
    sh3.columns(1).Resize(10).Copy destination:=rng.Offset(0,20)
    sh4.columns(1).Resize(10).Copy destination:=rng.Offset(0,30)
    end Sub

    --
    Regards,
    Tom Ogilvy


    "snow" <[email protected]> wrote in message
    news:[email protected]...
    > Hello everyone, these are the facts:
    > I need to copy data from some columns of sheet1 of workbook1 to sheet2
    > of workbook5
    > then do the same thing (sequentially) for workbook 2,3,4 , just
    > copying their A-J columns to sheet2 of workbook5...and the columns
    > from WB2,3,4 need to be pasted in the first empty column of sheet2 of
    > WB5
    >
    > I also need to be able to select (browsing in my hard disk) the file
    > representing workbook5.
    >
    > I think a way is to define a macro for WB 1,2,3,4 that allows me to
    > select the column I want to copy and paste and put them in the first
    > empty column of sheet2 of WB5...
    >
    > really hope sone can help me...(
    >




+ 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