+ Reply to Thread
Results 1 to 5 of 5

If/Then statement to copy/paste range of cells

  1. #1
    Registered User
    Join Date
    08-20-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    4

    If/Then statement to copy/paste range of cells

    I am trying to copy/paste a range of cells if a particular cell is equal to the cell below it.

    In the attached file I am going for something like:
    If B3 = B2, then copy C2:I2 , paste in C3:I3.
    repeat all of the way down

    I use the following code a good bit and have tried to manipulate it in different ways to get the desired result, but have not had any success. I realize this code below starts at the bottom and works up and I could do that as well if I sorted the attached spreadsheet by ascending column B, ascending column A (instead of descending as it is now)

    Please Login or Register  to view this content.
    thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: If/Then statement to copy/paste range of cells

    Does this work for your needs?

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: If/Then statement to copy/paste range of cells

    Another:

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    08-20-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: If/Then statement to copy/paste range of cells

    This is perfect! Thank you!

  5. #5
    Registered User
    Join Date
    08-20-2013
    Location
    Atlanta
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: If/Then statement to copy/paste range of cells

    Another good one as well. Among other things, I made the mistake playing with the ActiveCell.FormulaR1C1 format instead of just using the easier ActiveCell.Offset.

    Thank you!

+ 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. Replies: 1
    Last Post: 10-23-2012, 08:41 PM
  2. Copy, Paste Cells in a range
    By rawdog2222 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-08-2012, 12:13 PM
  3. Change range of cells within VBA macro and copy and paste to fixed cell range
    By Mannyny in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 07-20-2012, 11:51 AM
  4. Sub to Copy and Paste a Range of Cells
    By FrankB2050 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-07-2010, 09:39 AM
  5. Select a range of cells and then copy them, and paste into other cells
    By Dynelor in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-24-2007, 04:03 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