+ Reply to Thread
Results 1 to 5 of 5

COPY-PASTE Macro

  1. #1
    Registered User
    Join Date
    10-28-2005
    Posts
    2

    COPY-PASTE Macro

    Hello,

    I need to copy 'activeXworksheet.xls' contents into another worksheet. Cells I want to copy and then paste are: B94:B103, O94:O103, W94:W103, AA94:AA103, W118:127, AA118:AA127.

    This data (6 referece columns) I want to be placed onto another worksheet, where I have my cursor on it. Could you help me with the macro? How to write one?

    Thanks,

    macXpert

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello macExpert,

    It is not clear from your post if you have 2 workbooks open. You say you want to copy the data from the workbook 'activeXworksheet.xls' to another worksheet. The question is that worksheet in the same workbook or a different one? I am assuming also that the data will be copied to the same cells on the new worksheet regardless of where the cursor is on the new worksheet.

    Post back and let me know if I am hot or cold with what you want. You can also contact me by email [email protected].

    SIncerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    10-28-2005
    Posts
    2
    Hello Leith,

    Thanks for showing your keenness.

    I want to copy mentioned data from one workbook to another workbook. The destination workbook will remain the same but source workbook will be diffrent each time with constant references.

    And if the data is copied on destination workbook regardless where the cursor is then how can I manage dataflow onto destination file. I don't want data to spilt over the occupied cells. It would be acceptable too if it leaves next 2 or 3 rows blank and then start copying data again...

    Does this explanation made myself more clear? Let me know.

    Thanks again.

    macXpert

  4. #4
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello macXpert,

    I have a clearer picture of what you want. Just want to quickly recap the process before I start coding.

    The source workbook data is always in the same place (the 6 reference columns) B94:B103, O94:O103, W94:W103, AA94:AA103, W118:127, AA118:AA127, just different workbooks. In the destination workbook, which is always the same, you want to copy this data starting where the cursor is (the selected cell).

    Just to be sure I understand, you want all of the data to be copied into the same column where the cursor is and have a row or two separating the groups, right? One more question. Will have more than 2 workbooks open at the time?


    Thanks,
    Leith Ross

  5. #5
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello macXpert,

    Here is the macro code. You will need to copy and paste this code into a VB Module. First run the Macro called "AddToCellMenu". This adds a command to the Excel's Cell Popup Menu. Just right click the cell in the destination Workbook and click "Insert Rows/ Paste Here". This calls the "MainMacro", inserts the rows needed, and copies the 6 reference columns into the column of the active cell in the destination workbook. One empty line separates each of the source columns from the next one.

    When the macro runs it checks the open workbooks and lists them in an input box. Enter the name of the workbook to be used as the source. I did it this way to keep it simple. This way you can have multple workbooks open, and not be limited to only 2 - the source and destination.

    Macro Code:
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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