+ Reply to Thread
Results 1 to 15 of 15

Find a value, copy the row, move to next row.

Hybrid View

  1. #1
    Registered User
    Join Date
    11-22-2012
    Location
    Canton, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Find a value, copy the row, move to next row.

    It jumps back and forth between sheets but is only overwritting the data into a2:k2


    Quote Originally Posted by AB33 View Post
    Sub copyrows()
         
        Dim tfCol As Range, Cell As Object
         
        Set tfCol = Range("j2:j" & Cells(Rows.Count, "J").End(xlUp).Row)
         
        For Each Cell In tfCol
             
            If IsEmpty(Cell) Then
                Exit Sub
            End If
             
            If Cell.Value = "Startup" Then
                Cell.Offset(, -9).Resize(, 11).Copy
                Sheets("Startup").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlValues
               
            End If
             
        Next
         
    End Sub

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Find a value, copy the row, move to next row.

    This is better code

    Sub test()
    Dim i&, LR&
    With ActiveSheet
      LR = .Cells.Find("*", , , , xlByRows, xlPrevious).Row
      For i = 2 To LR
       If Len(.Cells(i, 10)) Then
            If Trim(.Cells(i, 10)) = "Startup" Then
            .Cells(i, 1).Resize(, 11).Copy
             Sheets("Startup").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial xlValues
            End If
         End If
      Next i
     End With
    End Sub

+ 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