+ Reply to Thread
Results 1 to 7 of 7

Paste Method

  1. #1
    Registered User
    Join Date
    06-29-2005
    Posts
    46

    Paste Method

    Why is the following not valid?

    Please Login or Register  to view this content.
    To understand the code in context, I have just copied a row using the EntireRow property and I am now pasting it into another row, except it is not working. Anyone have any suggestions?

  2. #2
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    can you paste the complete code

  3. #3
    Registered User
    Join Date
    06-29-2005
    Posts
    46
    Sure. The purpose of the macro is to import data from one workbook to the other. The problem is one workbook has extra lines in between the different headers (the headers and sections for each part of the Excel file have already been added and the content just needs to be put in there). Sorry if that's confusing, heres the code:

    Please Login or Register  to view this content.
    Thanks again for your help.

  4. #4
    Forum Contributor
    Join Date
    11-09-2004
    Posts
    451
    baseBook.ActiveSheet.Cells(basePos, "H").Select
    Rows(Selection.Row & ":" & Selection.Row).Select
    ActiveSheet.Paste

  5. #5
    K Dales
    Guest

    RE: Paste Method

    Hard to be sure without seeing the code, but I suspect you are pasting into a
    cell that is not in column A. If you are doing this it will fail since the
    "entire row" contains cells (blank ones count!) that would have to be pasted
    beyond the upper limit of the worksheet columns. This happens if you do it
    manually, too (select a row, copy, and paste into a cell in B and you will
    see).

    If this is indeed the reason it fails, paste into the destination cell's
    ..EntireRow and it should work.

    "Raman325" wrote:

    >
    > Why is the following not valid?
    >
    >
    > Code:
    > --------------------
    > Selection.EntireRow.Paste
    > --------------------
    >
    >
    > To understand the code in context, I have just copied a row using the
    > EntireRow property and I am now pasting it into another row, except it
    > is not working. Anyone have any suggestions?
    >
    >
    > --
    > Raman325
    > ------------------------------------------------------------------------
    > Raman325's Profile: http://www.excelforum.com/member.php...o&userid=24748
    > View this thread: http://www.excelforum.com/showthread...hreadid=383224
    >
    >


  6. #6
    jjk
    Guest

    Re: Paste Method

    The EntireRow property should work even if the Selection column is not
    A.

    I can think of one possibility where the EnitreRow can fail.
    If the the row contains merged cells is some format. This would mean
    that the paste action cannot change a part of the destination merged
    cells.

    However, it is tough to tell why without looking at the code and the
    sheet layout.

    Regards,
    Jayant


  7. #7
    Registered User
    Join Date
    06-29-2005
    Posts
    46
    That fixed it Anil, thank you very much. I also appreciate the comments and suggestions from jjk and K Dales.
    Last edited by Raman325; 06-29-2005 at 02:28 PM.

+ 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