+ Reply to Thread
Results 1 to 4 of 4

Paste range into only blank cells

Hybrid View

scrabtree23 Paste range into only blank... 03-02-2015, 03:45 PM
JOHN H. DAVIS Re: Paste range into only... 03-02-2015, 03:54 PM
scrabtree23 Re: Paste range into only... 03-03-2015, 11:57 AM
JOHN H. DAVIS Re: Paste range into only... 03-03-2015, 12:36 PM
  1. #1
    Forum Contributor
    Join Date
    07-27-2012
    Location
    Somerset, Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    123

    Paste range into only blank cells

    Let's say I have a range in sheet 1 from A1:E10 and I want to copy and paste that range in to sheet 2 range A1:E10. The catch is, if any of the cells in the destination range already have a value in them, I don't want that value to be overwritten. In other words, I only want the blank cells in sheet 2 to receive the paste from the corresponding cells in sheet 1.

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

    Re: Paste range into only blank cells

    Maybe:

    Sub scrabtree23()
    Dim i As Long, y As Long
    With Sheets("Sheet2")
        For i = 1 To 10
            For y = 1 To 5
                If .Cells(i, y) = "" Then
                    .Cells(i, y) = Sheets("Sheet1").Cells(i, y)
                End If
            Next y
        Next i
    End With
            
    End Sub

  3. #3
    Forum Contributor
    Join Date
    07-27-2012
    Location
    Somerset, Kentucky
    MS-Off Ver
    Excel 2007
    Posts
    123

    Re: Paste range into only blank cells

    Worked great. I can see how this will speed up a lot of cut and paste code I have done in the past, also.

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

    Re: Paste range into only blank cells

    Glad to see that it helped you out. Thanks for the feedback. Please mark this thread as solved.

+ 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. VBA: Copy non-blank and paste to separate sheet ONLY blank cells (running list)
    By brolsen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-10-2014, 03:34 PM
  2. Copy range and paste as value and clearcontants of blank cells and number
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-12-2014, 06:59 AM
  3. Replies: 18
    Last Post: 02-10-2013, 05:32 PM
  4. Replies: 15
    Last Post: 04-25-2012, 05:21 PM
  5. Advanced filter with blank cells / Dynamic named range with blank cells
    By Jason_2112 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2010, 12:06 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