+ Reply to Thread
Results 1 to 6 of 6

Dynamic insertion or deleting of blank cells

  1. #1
    Registered User
    Join Date
    12-07-2012
    Location
    london england
    MS-Off Ver
    Excel 2010
    Posts
    21

    Dynamic insertion or deleting of blank cells

    Hi Everyone,

    I don't know if it is possible to do what im hoping, but its worth asking the question.

    I work with accounts and apply for values of projects based on percentage complete, it would be laid out similar to below

    HEADER WORK TITLE VALUE PERCENTAGE SPLIT PERCENTAGE VALUE
    CONTRACTED WORKS 1920: INSTALL FANS £10000
    CONTRACTED WORKS 1930: ISTALL LIGHTS £20000

    What I would like to do in VBA is that we sometimes have to split it into percentages, this could be in 10% increments, 20%, 25%, 50% or 100% dependant on the client

    If in percentage split we selected on a data validation 20% on install fans, then I would like 5 blank lines inserted underneath with each value being split into 20% increments, so £2000 each one, if they decide to change this to 10% increments, then this should adapt it to 10 cells inserted in total and each value to be £1000, if they adapted it to 50% increments then it should be just to blank cells each worth £5000

    It would have to be a pretty clever code as you may have to insert cells if the percentage is reduced, but if the percentage is higher, then it would have to delete cells.

    I do hope that make sense, and would really appreciate any help.

    Kind regards,

    Simon.

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Dynamic insertion or deleting of blank cells

    Select a cell with the value to be split, and run this macro:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

  3. #3
    Registered User
    Join Date
    12-07-2012
    Location
    london england
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Dynamic insertion or deleting of blank cells

    Hi Bernie,

    Firstly many thanks for taking the time to respond,

    Ive made a start with my code, and im pretty much there, the only I need to do now, is if I add blank cells, below, so if ive changed it from 100% to 50% I need it to copy the data from the above cell, past below, but split the value in half etc.

    Below is my code

    Please Login or Register  to view this content.
    im trying to figure out how to attach an example!!
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Dynamic insertion or deleting of blank cells

    Try it like this - enter the number of splits you want (2 to n) in oolumn L


    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-07-2012
    Location
    london england
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Dynamic insertion or deleting of blank cells

    Again,

    Much appreciated for your help with this, im very close to what I need now, again below is where I have adapted your code, and where I still have a little issue.

    From the percentage split now its very good on when we change to split the value it will give the value correct based on some formulas (please see attached spreadsheet).

    The issue I have is if you then change a value say from 50 percent, where it has now duplicated a line, back to 100% your value is too high, therefore, we can only ever allow an ID no to ever be 100%, if its sees duplicates, it then needs to delete it, below is the code of where im at, and what will need to be adapted is the first bit of code that deletes with the deleting of cells, would appreciate if you can help again with this.

    Much appreciated,

    Simon

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,942

    Re: Dynamic insertion or deleting of blank cells

    Try these two macros:

    Please Login or Register  to view this content.

+ 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] Deleting Dynamic Blank Rows with Formulas
    By sherylt13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-19-2017, 09:45 AM
  2. Dynamic formulas insertion with VBA
    By QuentinChina in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-12-2013, 04:17 AM
  3. deleting blank cells
    By bostonguy in forum Excel General
    Replies: 2
    Last Post: 01-31-2012, 11:47 AM
  4. 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
  5. Dynamic Formulas and Sheet Insertion
    By nschmoyer in forum Excel General
    Replies: 4
    Last Post: 04-28-2009, 05:53 PM
  6. Deleting blank cells
    By Cononach in forum Excel General
    Replies: 4
    Last Post: 06-02-2007, 05:27 PM
  7. Deleting blank cells
    By savbci in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-29-2005, 02: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