+ Reply to Thread
Results 1 to 3 of 3

Code for Inserting & Deleting lines

  1. #1
    Forum Contributor
    Join Date
    02-04-2011
    Location
    Cape Town
    MS-Off Ver
    MS 365 Apps for Business
    Posts
    111

    Code for Inserting & Deleting lines

    Hello everyone

    I'm fairly new to vba so I need help!

    Request 1:

    I'm trying to create a macro that will automatically copy and insert/or delete rows based on a number that I put into a certain cell, say A1 or whatever cell I designate.

    The spreadsheet is a tenant list for a building. I will always have a 'master' row with formula's etc in it, but based on the number placed in A1, I want the macro to insert & copy/delete the number of rows matching the input. For eg. if A1 has 5 in it, I want the macro to copy the 'master' row so that there are a total of 5 rows, including the master. If I then change the input to 3, the macro must delete 2 rows, always keeping the master row at the top of the table.

    A second request:
    Similar to 1, but I will create the tenant table on sheet 1, I then want the macro to do the same inserting & copying/deleting in another sheet, say sheet 2. ie. the master row is on sheet 2 called, say cash flow. The number of rows that it inserts/deletes should be based on the number of rows it counts in the tenant table in sheet 1

    Is this too much to ask of the forum - I know you guys are whizzs at this stuff

    Thanks

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,342

    Re: Code for Inserting & Deleting lines

    Hi markvdh

    welcome to the forum
    Have a look at the attachments in this post for ideas
    http://www.excelforum.com/excel-gene...-with-vba.html
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Contributor
    Join Date
    02-04-2011
    Location
    Cape Town
    MS-Off Ver
    MS 365 Apps for Business
    Posts
    111

    Re: Code for Inserting & Deleting lines

    Hi Pike
    Thanks very much for your guidance - I will work through the code as best I can
    Regards,

+ 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