Results 1 to 3 of 3

Copy and Paste cells that match another cell

Threaded View

nenadmail Copy and Paste cells that... 08-08-2012, 05:06 AM
arlu1201 Re: Copy and Paste cells that... 08-08-2012, 05:50 AM
nenadmail Re: Copy and Paste cells that... 08-08-2012, 08:53 AM
  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Copy and Paste cells that match another cell

    I have this code that copies an entire row (of a cell that matches "i1" in column "AA7:AA100") and pastes the entire row in the next available row starting with AA1....
    But I DO NOT want it to copy an entire row, rather just between (AA:AQ) of the matching cell's row


    Private Sub Worksheet_Activate()
    Dim r As Range, x, c As Range
    Set r = Range("AA7:AA100")
    Application.ScreenUpdating = False
    ActiveSheet.Rows.Hidden = False
    For Each c In r
    If c = Range("i1").Value Then
    
    
    c.EntireRow.Copy = True
    
    
        Application.ScreenUpdating = False
        Dim TargWb As Workbook
        Dim iRow As Long
        Set TargWb = Workbooks("LITERATURE-CATALOG.xlsm")
        With TargWb.Sheets("StatusAnnual")
            iRow = WorksheetFunction.Max(1, .Cells.Find(What:="*", SearchOrder:=xlRows, _
                SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1)
            .Cells(iRow, 27).PasteSpecial Paste:=xlPasteValues
        End With
        Application.CutCopyMode = False
        Application.ScreenUpdating = True
    End If
    Next c
    Application.ScreenUpdating = True
    End Sub
    Last edited by nenadmail; 08-08-2012 at 05:08 AM.

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