Copy paste problem
Copy paste problem
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 7 of 7

Thread: Copy paste problem

  1. #1
    New Member
    Join Date
    Feb 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    How could you copy three cells in the same row to a different sheet?
    Ex.. I is the row count, and I want to copy the cell (I,”B) and Cell (I,”C”) And Cell (I,”M”)

    For i = Cells (Rows. Count, "M"). End (xlUp). Row To 1 Step –1

    I did that but it did not work??!!
    Cells(i,"B"),Cells(i,"C"),Cells(i,"M").copy

    Please help

  2. #2
    Guest

    Default

    Sub Copytest()
    Dim i As Double

    For i = Cells(Rows.Count, "M").End(xlUp).Row To 1 Step -1
    Application.Union(Cells(i, "B"), Cells(i, "C"), Cells(i, "M")).Copy Cells(i, "N")
    Next

    End Sub

    HTH

    Ivan

  3. #3
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Forgot to mention that I assumed you were
    to paste to Column N ??

    Change as required


    Ivan

  4. #4
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    That should be.......

    Sub Copytest()
    Dim i As Double

    For i = Cells(Rows.Count, "M").End(xlUp).Row To 1 Step -1
    Application.Union(Cells(i, "B"), Cells(i, "C"), Cells(i, "M")).Copy Sheets("Sheet2").Cells(i, "A")
    Next

    End Sub


    Ivan

  5. #5
    New Member
    Join Date
    Feb 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


  6. #6
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just to make sure we're on the same track, Ivan's code pastes the code to Sheet2!A:C, not Sheet2!B, C and M.

    Regards,

    Juan Pablo González
    http://www.juanpg.com

  7. #7
    New Member
    Join Date
    Feb 2002
    Posts
    14
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Thank you it worked perfectly

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com