+ Reply to Thread
Results 1 to 5 of 5

VB code to insert/delete number of rows based on cell value

Hybrid View

  1. #1
    Registered User
    Join Date
    04-02-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    79

    VB code to insert/delete number of rows based on cell value

    Hi,

    Need help with a VB code that will insert/delete numbers of rows based on a cell value.
    Example: if cell value is 2, then insert 2 rows starting from row 1. if cell value is -4, then delete 4 rows starting from row 1.

    Any help is greatly appreciated.

    Thanks
    Shreeja.

  2. #2
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: VB code to insert/delete number of rows based on cell value

    How are you able to differentiate between when you want to insert and when you want to delete?
    Please do add reputation where you see fit, it's nice to be nice and we all enjoy a pat on the back

    Please also mark your thread as solved once it has been.

  3. #3
    Registered User
    Join Date
    04-02-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: VB code to insert/delete number of rows based on cell value

    Based on the sign of number (insert if positive, delete if negative)

  4. #4
    Registered User
    Join Date
    04-02-2014
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    79

    Re: VB code to insert/delete number of rows based on cell value

    Quote Originally Posted by PFDave View Post
    How are you able to differentiate between when you want to insert and when you want to delete?
    Based on the sign of number (insert if positive, delete if negative)

  5. #5
    Valued Forum Contributor PFDave's Avatar
    Join Date
    05-17-2012
    Location
    Milton Keynes, England
    MS-Off Ver
    Excel 2013
    Posts
    1,067

    Re: VB code to insert/delete number of rows based on cell value

    OK and which Cell are we referring to? is it any cell in the workbook (I doubt) or a specific cell or a cell contained within a specific range?

    Sample workbook would probably speed this all up

+ 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] Modify Macro to insert/delete rows based on cell value
    By Marvelous in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2013, 10:49 AM
  2. Replies: 2
    Last Post: 10-31-2013, 05:00 PM
  3. [SOLVED] How to insert number of rows based on value of a Cell
    By sathyasun in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-24-2013, 12:47 AM
  4. [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
  5. Insert / Delete rows based on cell value
    By duckdodgers in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-30-2012, 04:07 PM
  6. [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
  7. Insert a number of rows based on the value in a cell
    By garridosk in forum Word Programming / VBA / Macros
    Replies: 2
    Last Post: 11-16-2011, 04:41 PM
  8. Delete Rows based on cell value and then Insert rows alternatively with a formula
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-11-2008, 04:27 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