Results 1 to 13 of 13

VBA code to copy and paste an entire row from one sheet to another

Threaded View

emach VBA code to copy and paste an... 09-19-2013, 04:00 PM
emach Re: VBA code to copy and... 09-19-2013, 04:14 PM
jaslake Re: VBA code to copy and... 09-19-2013, 04:24 PM
emach Re: VBA code to copy and... 09-19-2013, 04:56 PM
jaslake Re: VBA code to copy and... 09-19-2013, 05:52 PM
emach Re: VBA code to copy and... 09-24-2013, 08:14 AM
jaslake Re: VBA code to copy and... 09-24-2013, 10:08 AM
AB33 Re: VBA code to copy and... 09-24-2013, 09:42 AM
emach Re: VBA code to copy and... 09-24-2013, 10:13 AM
jaslake Re: VBA code to copy and... 09-24-2013, 10:26 AM
AB33 Re: VBA code to copy and... 09-24-2013, 10:39 AM
emach Re: VBA code to copy and... 09-24-2013, 11:55 AM
jaslake Re: VBA code to copy and... 09-24-2013, 12:12 PM
  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Houston, Texas
    MS-Off Ver
    Excel 2010
    Posts
    6

    VBA code to copy and paste an entire row from one sheet to another

    This is my first post. I can usually create the simple macros I need or research to find help, but I can't get this one to work. It is mostly a copied macro from someone else that I was trying to customize.

    I need it to copy the entire row (not just the value of one cell) from one sheet to another in the same wb. Currently it looks for a value that is in a column on sheet 1 and not in a column on sheet 2, then pastes the value in the column on sheet 2, but I need it to pasted the entire row. Any help would be much appreciated!

    This is what I have so far...


    Sub P_and_ID_Archive_Macro()
    Dim Rng, Dn As Range, n As Long, RngA As Range, RngB As Range
    Dim SubRng, Q
    Set RngA = Range(Range("B1"), Range("B" & Rows.Count).End(xlUp))
      With Sheets("P&ID Archival Status")
        Set RngB = .Range(.Range("C1"), .Range("C" & Rows.Count).End(xlUp))
          End With
             Rng = Array(RngA, RngB)
                ReDim Ray(1 To RngA.Count + RngB.Count)
    With CreateObject("scripting.dictionary")
        .CompareMode = vbTextCompare
            For SubRng = 0 To UBound(Rng)
               For Each Dn In Rng(SubRng)
                    If Not .Exists(Dn.Value) Then
                        n = n + 1
                        .Add Dn.Value, Array(n, SubRng)
                        Ray(n) = Dn.Value
                    Else
                        Q = .Item(Dn.Value)
                        If Not Q(1) = SubRng Then
                            Ray(Q(0)) = vbNullString
                        End If
                    End If
            Next Dn
            Next SubRng
    End With
    With Sheets("P&ID Archival Status").Range("C" & Rows.Count).End(xlUp).Offset(1).Resize(n)
    .Value = Application.Transpose(Ray)
    .SpecialCells(xlCellTypeBlanks).Delete
    End With
    Last edited by Fotis1991; 09-19-2013 at 04:02 PM. Reason: Pls use code tags around your code

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. to copy paste the entire row to the new sheet
    By karanpreet in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 04-15-2013, 10:51 AM
  2. Help with Copy entire row and paste to new sheet
    By 20lgt06 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2013, 09:24 AM
  3. Copy paste entire row different sheet column C
    By nahge123 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-15-2012, 02:16 PM
  4. If Y in column N, copy&paste entire row into new sheet
    By BSCIEddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2011, 04:58 AM
  5. Copy Entire Row & Paste in First Empty Row On The Same Sheet
    By Emonk in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-23-2011, 11:41 AM

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