+ Reply to Thread
Results 1 to 15 of 15

copying entire row from one sheet to another

Hybrid View

  1. #1
    Registered User
    Join Date
    11-08-2006
    Posts
    30
    Quote Originally Posted by T-J
    That's because it always pastes starting at row 2 (IntS = 2).
    You need to get the last used row on the results sheet and paste to the row after:

    Dim lastRow As Long
    lastRow = wSht.Cells.SpecialCells(xlCellTypeLastCell).Row    'last used row on results sheet
    
    rngC.EntireRow.Copy wSht.Cells(lastRow + 1, 1)   'paste to row after
    Note the use of a Long Integer type instead of Integer (max 32,767) to prevent overflow.

    where should i insert those codes exactly ?

  2. #2
    Valued Forum Contributor
    Join Date
    08-26-2006
    Location
    -
    MS-Off Ver
    2010
    Posts
    388
    Quote Originally Posted by EddyAddelan
    where should i insert those codes exactly ?
    At the top, after the variable declarations:

    Dim lastRow As Long
    Set wSht = ThisWorkbook.Worksheets("Sheet2")     'results sheet
    lastRow = wSht.Cells.SpecialCells(xlCellTypeLastCell).Row    'last used row on results sheet
    In the copy/paste Do..Loop (replace what's there):

    rngC.EntireRow.Copy wSht.Cells(lastRow + 1, 1)
    lastRow = lastRow + 1
    Set rngC = .FindNext(rngC)

+ 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