+ Reply to Thread
Results 1 to 5 of 5

copy and paste entire row in excel using vba

  1. #1
    Registered User
    Join Date
    07-10-2006
    Posts
    4

    copy and paste entire row in excel using vba

    ok. vba newbie...

    i want to select and entire row in excel in sheet 1, and paste the entire row into sheet 2. (2 different worksheets in the same workbook)

    what code do i need to do this?

  2. #2
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    you first need to decide on which row - it could be the active cell row, or you could specify a cell

    for the active cell row

    sheets("sheet1").activate
    activecell.entirerow.copy sheets("sheet2").cells(A,1)

    for the specified cell case
    sheets("sheet1").activate
    Cells(B,C).entirerow.copy sheets("sheet2").cells(A,1)

    in both cases, A is the row number on sheet2 where you want to paste it
    in the latter case, B is the row number and C is the column number of the cell for the row you want to copy
    not a professional, just trying to assist.....

  3. #3
    Registered User
    Join Date
    07-10-2006
    Posts
    4
    can i use something like:

    rows() to select the row to copy and paste?

  4. #4
    Valued Forum Contributor
    Join Date
    07-11-2004
    Posts
    851
    you can either select a cell using the cursor in which it becomes the active cell, or you can specify it in the macro. A third aproach would be if you wanted the last row of data (asuming <60000 rows of data)- then

    cells(60000,1).end(xlup).entirerow.copy

  5. #5
    Registered User
    Join Date
    07-10-2006
    Posts
    4

    Smile

    thanks. it worked!

+ 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