+ Reply to Thread
Results 1 to 2 of 2

Macro to copy data from one workbook to another

  1. #1
    supamari0
    Guest

    Macro to copy data from one workbook to another

    Hi,

    I need to create a macro that opens up a specific excel file. This file has
    data that is split into twelve different columns (one for each month). I need
    this macro to create a msgbox that allows the user to select the month and
    then copy all the data in that row to the other document.

    Anyone have any ideas on this one?

    Thanks in Advance!

  2. #2
    Tom Ogilvy
    Guest

    RE: Macro to copy data from one workbook to another

    You say each month is in a column, then the user selects a specific colum
    (month) and copies a row -- What row? assuming you mean column:

    You can select a column with

    Dim sh as Worksheet, bk as Workbook
    Dim rng as Range
    set bk = Workbooks.Open("C:\MyFolder\Myfile.xls")
    on error resume next
    set rng = Application.InputBox("select a column with your mouse",type:=8)
    On error goto 0
    if rng is nothing then
    bk.close Savechanges:=false
    exit sub
    end if
    rng.EntireColumn.Copy Destination:= _
    sh.Columns(3)
    bk.close Savechanges:=False

    --
    Regards,
    Tom Ogilvy

    --
    Regards,
    Tom Ogilvy


    "supamari0" wrote:

    > Hi,
    >
    > I need to create a macro that opens up a specific excel file. This file has
    > data that is split into twelve different columns (one for each month). I need
    > this macro to create a msgbox that allows the user to select the month and
    > then copy all the data in that row to the other document.
    >
    > Anyone have any ideas on this one?
    >
    > Thanks in Advance!


+ 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