Results 1 to 4 of 4

Copying and pasting worksheets based on one condition

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    10-21-2011
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    513

    Copying and pasting worksheets based on one condition

    Hi,

    I'm simplying trying to copy everything in worksheet "raw" into worksheet "final set" based on one condition, which is that I want to copy all the rows where the status equals "keep". I want to skip the ones with "delete" status. I have attached the workbook.

    I also have some codes written up, but I am getting an "400" error.

    Sub extractKeeps()
    
    Dim r As Integer
    Dim c As Integer
    Dim lastRow As Long
    
    Application.ScreenUpdating = False
    lastRow = Worksheets("raw").UsedRange.Rows.Count
    
    For r = 1 To lastRow
        For c = 1 To 9
        
        If Cells(r, 9).Value = "keep" Then
        Worksheets("raw").Cells(r, c).EntireRow.Copy = Worksheets("Final Set").Paste
        End If
        
        Next c
        Next r
    
    Application.ScreenUpdating = True
    End Sub
    Any help is appreciated.
    Attached Files Attached Files
    Last edited by Lifeseeker; 04-09-2013 at 12:52 PM.

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