+ Reply to Thread
Results 1 to 3 of 3

Copy data from one sheet to another while skipping blanks and certain rows

Hybrid View

  1. #1
    Registered User
    Join Date
    02-03-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2013
    Posts
    22

    Copy data from one sheet to another while skipping blanks and certain rows

    Hi. I'm trying to copy data from one sheet to another, but I want it to skip blanks and a row that has data on it. I've attached my spreadsheet that I need help on.

    I want o9:o12, o14:o17, o19:o22, o24:o27, and o29:o34 from Sheet1 to be moved to A8:A33 on Sheet 2. Those cells have a vlookup formula that makes the code below not work.

    Rows 13, 18, 23, and 28 on Sheet1 need to be left out.

    The data currently looks like this on Sheet1:
    Cinnamon Apple Slices


    Fresh Red Delicious Apple

    On Sheet2, I want the data to look like below with no spaces between each menu item.

    Cinnamon Apple Slices
    Fresh Red Delicious Apple

    Sub Copy_Stuff2()
    Application.ScreenUpdating = False
    Sheets("Sheet2").Range("A8:A33").ClearContents
    With Sheets("Sheet1").Range("o9:o12, o14:o17, o19:o22, o24:o27, and o29:o34").SpecialCells(xlCellTypeConstants)
    .Copy
    Sheets("Sheet2").Range("A8").PasteSpecial xlPasteValues
    'ClearContents 'Clear source data
    End With
    Application.CutCopyMode = True
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files
    Last edited by arlu1201; 02-15-2013 at 07:34 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy data from one sheet to another while skipping blanks and certain rows

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Copy data from one sheet to another while skipping blanks and certain rows

    Is this solved?

    If you solve a problem yourself before anyone else has responded, please take a moment to describe your solution, chances are some other member will benefit.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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