+ Reply to Thread
Results 1 to 6 of 6

Insert Rows Based on Input Cell

  1. #1
    Registered User
    Join Date
    06-13-2014
    Posts
    11

    Insert Rows Based on Input Cell

    Hello All!


    This is my first time on Excel Forum and I am looking for some help here with VBA, as I am very new to it. I am trying to make a relatively simple excel spreadsheet for a theoretical stock portfolio.

    What I need from all you brains is help to create a list of theoretical stocks based on the input number of stocks to be held in the portfolio. The number of stocks would be an input cell. So if I place '10' in the input cell I need 10 rows to be placed in the table, along with its respective formulas. If I placed '15' into the input cell I would need 15 Rows to be placed into the table.

    It gets a little more intricate with the returns and stock classifications. If anyone could help it would be greatly appreciated. If needed I could always send the file :D

  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 Input Cell

    Does this help?

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-13-2014
    Posts
    11

    Re: Insert Rows Based on Input Cell

    Thanks for the help. I almost seemed to get it to work, however, It only inserted rows in row A and not the adjacent rows in the table range. (Range A-F) I also need to get these cells to be numbered in a series, hence changing the formula.

  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 Input Cell

    Can you attach a sample showing what your layout would look like before the macro, and a result sheet after the macro? Please include the formula that you want to insert.

  5. #5
    Registered User
    Join Date
    06-13-2014
    Posts
    11

    Re: Insert Rows Based on Input Cell

    picture excel 3.PNGpicture excel.PNG

    This is the image as to what it looks like currently. A "Winner" stock is one in which returns a specified percentage (15% in this example) and a loser does not meet that, and its loss potential is set at a max of 5% in which the stock would return the "Stop Out." I do not feel that this is set up correctly or in the best manner. Currently there is no formula to automatically change how many winners there are in the portfolio.

    picture excel 2.PNG

    The Second example has two extra rows. However the former creater of the template put restrictions on the input level for the cells so that it cannot exceed 10.

    Formula for amount:
    =IF(A22>$C$3,0,$B$18/$C$3)

    The whole template I was given is pretty unworkable in my opinion.
    Last edited by mbergamo; 06-17-2014 at 11:29 AM. Reason: Input Cells

  6. #6
    Registered User
    Join Date
    06-13-2014
    Posts
    11

    Re: Insert Rows Based on Input Cell

    Honestly this method is a little simpler and is what it should actually look like
    optimal.PNG
    optimal 2.PNG How it should look if there are only 6 stocks
    Amount:
    $D$3/$D$4

    Can't figure out how to have the cells populate with the Winner/Loser Criteria based on the "Batting Average" (Number that are winners) so that was put in by hand

    Return:
    =IF(D11="Winner",C11*(1+$D$7),C11*(1-$D$6))
    Last edited by mbergamo; 06-17-2014 at 11:55 AM.

+ 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. Insert # of Rows based on User Input
    By afpilotb1 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-23-2014, 11:40 AM
  2. [SOLVED] Event Macro to insert text in cell based on input of another cell
    By nplouffe in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-08-2012, 11:54 AM
  3. Instantly change column values after copy/insert rows based on input - Selection parameter
    By BuzzOffSweetheart in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-20-2012, 09:47 AM
  4. [SOLVED] Macro based on User input to Insert X amount of rows - Need advanced help
    By BuzzOffSweetheart in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-19-2012, 07:06 PM
  5. Insert rows based on user input from cell value in other sheet
    By MrPisky in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 10-31-2011, 09:08 PM

Tags for this Thread

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