+ Reply to Thread
Results 1 to 10 of 10

Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

  1. #1
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Excuse my naivety, but any assistance would be greatly appreciated. Basically I have two columns of data within a range that I want to paste into two empty columns within a dataset, I've used the following code for a start, but it lacks the ability to only select filled sells from the DealTemplate and won't paste in the empty rows in the DealList.sheet. I've attached an example sheet. I've had this macro in my sheets before, but for the life of me I can't remember the code that tweaks it to do what I need. Thanks in advance for any help!!!!

    Sub CopyPaste_Click()
    Application.ScreenUpdating = False
    Dim copySheet As Worksheet
    Dim pasteSheet As Worksheet

    Set copySheet = Worksheets("DealTemplate")
    Set pasteSheet = Worksheets("DealList")

    copySheet.Range("y5:z49").Copy
    pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 1).PasteSpecial xlPasteValues
    Application.CutCopyMode = False
    Application.ScreenUpdating = True
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Try:
    Please Login or Register  to view this content.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Worked great, but I need to be able to continue pasting down in the DealList sheet as I update the Deal template... I.e. the macro needs to find the next empty cells in B/C and paste the deal numbers into those cells. Also, I need it to only paste the number of rows containing data from DealTemplate as copying the whole range seems to paste all 20 rows from the DealTemplate to the Deal List...

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    This macro will take care of pasting the data to the first empty cell in column B. I don't quite follow what you mean by the second part of your question. In the file you posted there are 16 rows with data in the range Y5:Y20 in sheet "DealTemplate" and the macro is copying/pasting only those 16 rows not 20 rows. Please clarify.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    So this will be a dynamic spreadsheet, with every day a new list of deals being inputed. Deal numbers will be manually entered into the deal template sheet each day. Each day I would like to hit the copy paste button and paste the new deal numbers into the DealList sheet. Then the next day the process repeats and the macro copies and pastes that days new deal numbers under the previous days' deals. Maybe that makes a bit more sense?

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Have you tried the macro in Post# 4. I believe it does what you ask.

  7. #7
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Ahhhh I see!!! yes it does only issue is that you have to step through it on the DealList sheet, otherwise it gets a runtime error. I'd like to get the button on the DealTemplate sheet and assign the macro to that... I know I'm getting way too picky... thanks for the help so far though!!!! And I'm sure its a simple fix...

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    This version should work from either sheet:
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-26-2012
    Location
    Houston
    MS-Off Ver
    Excel 2007
    Posts
    24

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    Yes!!! you my friend are a gentleman and a scholar!!!! Works perfectly!!! thanks so much!!!

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,810

    Re: Copy and Paste only filled cells from a dynamic range to another sheet in empty cells

    My pleasure.

+ 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. Need to find empty filled cells in a column and copy to the empty cell below
    By Grahamfeeley in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-30-2014, 10:09 AM
  2. Replies: 0
    Last Post: 03-20-2014, 11:51 AM
  3. how to copy a range of cells, paste them and then find next empty cell
    By comp23 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2013, 03:34 PM
  4. [SOLVED] Copy and Paste Cells to Next empty cell in range
    By oddinho2 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 09-20-2013, 12:51 PM
  5. Replies: 1
    Last Post: 04-22-2013, 10:34 AM
  6. VBA macro to Find a dynamic range of cells, copy then paste to another sheet
    By Bmxerdude2087 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-24-2012, 02:36 PM
  7. Copy Data From Filled to Empty Cells
    By Sheikh Saadi in forum Excel General
    Replies: 0
    Last Post: 11-10-2005, 03:30 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