+ Reply to Thread
Results 1 to 2 of 2

VBA copy cells to same destination row as the first pasted cell

  1. #1
    Registered User
    Join Date
    05-15-2014
    MS-Off Ver
    Excel 2003
    Posts
    15

    VBA copy cells to same destination row as the first pasted cell

    Hi All

    This formula is great except i need it to paste the other copied cells the the same row as 'cell A' was pasted.
    Is that possible?

    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Not Intersect(Target, Range("D3:D" & Range("A" & Rows.Count).End(3).Row)) Is Nothing Then

    {If Target.Value = "y" Or Target.Value = "Y" Then
    Range("A" & Target.Row).Copy Sheets("secondref").Range("A" & Rows.Count).End(3)(2)
    Range("B" & Target.Row).Copy Sheets("secondref").Range("B" & Rows.Count).End(3)(2)
    Range("C" & Target.Row).Copy Sheets("secondref").Range("C" & Rows.Count).End(3)(2)
    Range("E" & Target.Row).Copy Sheets("secondref").Range("E" & Rows.Count).End(3)(2)
    Range("L" & Target.Row).Copy Sheets("secondref").Range("F" & Rows.Count).End(3)(2)
    Range("H" & Target.Row).Copy Sheets("secondref").Range("J" & Rows.Count).End(3)(2)
    Range("I" & Target.Row).Copy Sheets("secondref").Range("K" & Rows.Count).End(3)(2)
    Range("J" & Target.Row).Copy Sheets("secondref").Range("L" & Rows.Count).End(3)(2)
    End If
    End If
    End Sub}

    thanks
    Amanda

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: VBA copy cells to same destination row as the first pasted cell

    You need to pass this into a variable, then reuse

    Range("A" & Rows.Count).End(3)(2)
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Destination cell is empty after copy and paste
    By wingnut74 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2014, 05:56 PM
  2. Copy cell colour to destination file
    By Daedalusfbo in forum Excel General
    Replies: 5
    Last Post: 01-27-2011, 12:10 PM
  3. VBA Function to copy Row Array to destination Cell
    By yogeshmaney in forum Excel General
    Replies: 1
    Last Post: 03-05-2010, 03:26 AM
  4. Using destination filepaths listed in cell contents opposing to coding destination
    By kuraitori in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2009, 01:23 PM
  5. Macro to Copy value in a given destination cell
    By urtzi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2008, 12:08 PM

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