+ Reply to Thread
Results 1 to 5 of 5

Insert/Delete rows based on the same numbers of rows with data in other sheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Insert/Delete rows based on the same numbers of rows with data in other sheet

    Count the number of rows with data in sheet "Pay Data" (starting A4) and double the amount and insert that rows in sheet "Journal" (starting A17).

    Thanks
    Attached Files Attached Files
    Last edited by Blokeman; 02-25-2015 at 09:34 PM.
    Please click the * Add Reputation if this helps
    If solved remember to mark Thread as solved

    "I'm glad to help and this is not meant to sound smart, but either you have super-human vision to see all those controls cleared one by one with the code I posted, or your computer is really slow."

  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: Insert rows based on the same numbers of rows with data in other sheet

    Maybe:

    Sub Blokeman()
    Dim x As Long, y As Long
    x = Sheets("Pay Data").Range("A" & Rows.Count).End(3).Row - 4
    y = x * 2
    Sheets("Journal").Range("A17").Offset(1).Resize(y).EntireRow.Insert
    End Sub

  3. #3
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Insert rows based on the same numbers of rows with data in other sheet

    Thanks John

  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: Insert rows based on the same numbers of rows with data in other sheet

    You're welcome. Glad to help out.

  5. #5
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Insert rows based on the same numbers of rows with data in other sheet

    Hi John,

    I still need your help one last time. What if there's already data in sheet"Journal"(let's say 101 rows, separated by empty row in the middle, 50 rows top and then blank row then 50 rows bottom)start in row 16. In sheet"Pay Data" count number of filled rows start at row 4. If the number of rows is 55 then it will add 5 rows on the top rows and also 5 rows at the bottom in sheet"Journal", in other word if less then delete rows and if more the add. Upload sample file.

    Thanks
    Attached Files Attached Files

+ 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. [SOLVED] insert rows based on number in cell and copy the data down into the new rows
    By pziefle in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-05-2013, 11:19 AM
  2. Insert rows based on a value in a cell and copy the data down into the new rows
    By eyeman96 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2013, 07:54 AM
  3. [SOLVED] Insert Multiple Rows Based Off Number in Cell and Copy Data From Above New Rows
    By tstell1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2012, 04:15 PM
  4. Insert multiple rows from one sheet to another based on a value in a cell
    By sashikanth2274 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-14-2010, 11:37 PM
  5. Insert numbers before data in multiple rows
    By Brandy in forum Excel General
    Replies: 4
    Last Post: 01-07-2009, 11:57 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