+ Reply to Thread
Results 1 to 6 of 6

Copy 2 cells and paste - looping

Hybrid View

  1. #1
    Registered User
    Join Date
    02-07-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    53

    Copy 2 cells and paste - looping

    Hi,

    I have code which copies Range("A1") and pastes into Range("c1").Then it loops to copy a2,a3,a4 and pastes in the same cell c1.

    I just want to copy a1 and b1 instead of just a1 and paste into cell c1& c2.Then loop to copy a2&b2 till end.

    SUB LOOPING_2CELLS()
    
    Dim rngCell As Range
    
    For Each rngCell In Sheets("SHEET1").Range("A1", Sheets("SHEET1").Range("A" & Rows.Count).End(xlUp))
      Sheets("SHEET1").Range("C1").Value = rngCell.Value
    
    
    Next rngCell
    
    END SUB

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,692

    Re: Copy 2 cells and paste - looping

    This certainly can't be what you mean but that's how I understand it.
    Sub WhoKnows()
    Dim lr As Long
        lr = Cells(Rows.Count, 1).End(xlUp).Row
            Range("A1:B" & lr).Copy Range("C1")
    End Sub

  3. #3
    Forum Contributor
    Join Date
    08-17-2013
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    132

    Re: Copy 2 cells and paste - looping

    Please elaborate little more.

    If I understood you correctly then you want to loop through two columns A and B from end to start then want to paste value at Column C like A1 value to C1, B1 value to C2, A2 value to C3, B2 value to C4 and so on..

    Please correct me if I am wrong.

    Regards,

  4. #4
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Copy 2 cells and paste - looping

    I has solved your problem....

    Solution is given below this post....


    click * to appreciate
    Last edited by Vikas_Gautam; 06-29-2014 at 12:02 PM.

  5. #5
    Forum Expert Vikas_Gautam's Avatar
    Join Date
    06-04-2013
    Location
    Ludhiana,Punjab, India
    MS-Off Ver
    Excel 2013
    Posts
    1,850

    Re: Copy 2 cells and paste - looping

    Try this
    exactly what you want

    Sub copy()
    For c = 1 To 60000
    'required range
    ReqR = "a" & c & ":" & "b" & c
    Range(ReqR).copy Range(ReqR).Offset(0, 2)
    Next
    DoEvents
    End Sub

  6. #6
    Registered User
    Join Date
    02-07-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    53

    Re: Copy 2 cells and paste - looping

    Thanks Mates,

    I am bit late to thank you for all your sincere efforts.Your help really solved my need.

    Thanks,

    Netaji

+ 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. Folder Copy/Paste Looping
    By gibsonj4 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-17-2014, 02:41 PM
  2. [SOLVED] Help with Looping a copy and paste marco
    By Robert110 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 03-26-2013, 11:02 AM
  3. [SOLVED] VBA Looping Copy and Paste
    By harrison298 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-11-2012, 11:43 AM
  4. Looping Through Some Sheets to Sort Copy & Paste
    By luke1438 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2010, 12:57 PM
  5. Looping Copy/Paste Macro
    By yuuuh in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2010, 11:56 PM

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