+ Reply to Thread
Results 1 to 3 of 3

match copy and delet

Hybrid View

  1. #1
    Registered User
    Join Date
    03-14-2012
    Location
    Yemen
    MS-Off Ver
    Excel 2010
    Posts
    22

    Unhappy match copy and delet

    plz I have the example attachment here with code find and copy but I want that after copy match row I need to delete it from master sheet
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    07-27-2012
    Location
    Malaysia
    MS-Off Ver
    Excel 2007/2010
    Posts
    86

    Re: match copy and delet

    Halo~
    Try this
    Sub CopyRows()
    Dim rng As Range
    For I = 2 To Sheets("name").Cells(Rows.Count, "A").End(xlUp).Row
    
    Set vfound = Sheets("Data Set").Columns("F:I").Cells.Find(What:=Sheets("name").Range("A" & I).Value, _
    MatchCase:=False)
    
    If Not vfound Is Nothing Then
    vStart = vfound.Address
    vMatch = True
    
    Do
    Sheets("Data Set").Range("A" & vfound.Row & ":" & "I" & vfound.Row).Copy Destination:= _
    Sheets("Output Sheet").Range("A" & Sheets("Output Sheet").Cells(Rows.Count, "A").End(xlUp).Row + 1 _
    & ":" & "I" & Sheets("Output Sheet").Cells(Rows.Count, "A").End(xlUp).Row + 1)
    If rng Is Nothing Then
        Set rng = vfound
    Else
        Set rng = Union(rng, vfound)
    End If
    Set vfound = Sheets("Data Set").Columns("f:i").Cells.FindNext(vfound)
    Loop Until vfound.Address = vStart
    End If
    rng.EntireRow.Delete
    Set rng = Nothing
    Next I
    
    If vMatch <> True Then
    MsgBox ("NO MATCHES FOUND")
    End If
    
    End Sub
    Boon

  3. #3
    Registered User
    Join Date
    03-14-2012
    Location
    Yemen
    MS-Off Ver
    Excel 2010
    Posts
    22

    Re: match copy and delet

    thaaaaaaaaaaaaaaaaaaaaaaaaaaaaaanks alot.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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