Results 1 to 5 of 5

If/Then statement to copy/paste range of cells

Threaded View

  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)

     Dim i, LastRow
        LastRow = Range("G" & Rows.Count).End(xlUp).Row
        For i = LastRow To 5 Step -1
        If Cells(i, "G").Value = "0" Then
        Cells(i, "G").EntireRow.Delete
        End If
        Next
    thank you!
    Attached Files Attached Files

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