Results 1 to 12 of 12

Insert Blank Rows and Copy Rows Above it with Data to These blank rows With Conditions

Threaded View

pato225 Insert Blank Rows and Copy... 07-29-2015, 11:15 AM
Greg M Re: Insert Blank Rows and... 07-29-2015, 08:52 PM
pato225 Re: Insert Blank Rows and... 07-29-2015, 11:33 PM
event21 Re: Insert Blank Rows and... 07-29-2015, 09:38 PM
pato225 Re: Insert Blank Rows and... 07-29-2015, 11:39 PM
event21 Re: Insert Blank Rows and... 07-30-2015, 12:17 AM
Greg M Re: Insert Blank Rows and... 07-30-2015, 08:17 AM
pato225 Re: Insert Blank Rows and... 07-30-2015, 10:41 AM
JOHN H. DAVIS Re: Insert Blank Rows and... 07-30-2015, 08:58 AM
Steve7913 Re: Insert Blank Rows and... 07-30-2015, 09:17 AM
pato225 Re: Insert Blank Rows and... 07-30-2015, 10:47 AM
Greg M Re: Insert Blank Rows and... 07-30-2015, 12:35 PM
  1. #1
    Registered User
    Join Date
    01-15-2013
    Location
    Louisville, USA
    MS-Off Ver
    Excel 2007
    Posts
    19

    Insert Blank Rows and Copy Rows Above it with Data to These blank rows With Conditions

    Hi, I wanted to insert blank rows below and copy and paste the rows above to those blank rows when certain conditions are met. For example when you see a value 112 in column E then insert a blank row below it and copy and paste that same row above containing the value 112 onto the blank row you just created and also when you see 159 in column E perform this function above. I started building this out but ran into issues. Can someone please take a look? I will much appreciate this. Thanks

    Code

    
    Sub pins()
    
    Dim z1, z3, z4 As Range
    
    Set z1 = Sheets("Sheet1").Range("E2:E15").End(xlDown)
    Do Until z1.Row = 1
    
    If z1.Value = "112" Then
    z1.EntireRow.Offset(1).Insert
    End If
    
    Set z1 = z1.Offset(-1)
    Loop
    
    Dim z2 As Range
    Set z2 = Sheets("Sheet1").Range("E2:E15").End(xlDown)
    Do Until z2.Row = 1
    If z2.Value = "112" Then
    z2.EntireRow.Select
    Selection.SpecialCells(xlCellTypeVisible).Copy
    z2.Offset(1).Paste
    End If
    Set z2 = z2.Offset(-1)
    Loop
    End Sub
    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. [SOLVED] insert blank rows every nth row and copy down data to fill blank rows
    By surpass in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-06-2014, 02:55 PM
  2. Replies: 4
    Last Post: 09-16-2014, 10:48 AM
  3. How to create a macro to insert blank rows and copy data into blank rows?
    By zodiack101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-29-2013, 01:18 PM
  4. Copy up to blank cell, transpose, and insert rows without overwriting data below
    By scooter7 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-10-2013, 10:48 PM
  5. [SOLVED] Delete blank rows between data rows, shift rows up, then repeat
    By excelactuary in forum Excel General
    Replies: 2
    Last Post: 03-11-2013, 11:53 AM
  6. [SOLVED] Macro to insert blank rows so that the total number of rows with data is equal to 1021
    By nsm1411 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-07-2013, 10:25 AM
  7. Replies: 1
    Last Post: 05-19-2011, 09:53 AM

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