+ Reply to Thread
Results 1 to 2 of 2

worksheet_change to insert row's when needed

  1. #1
    Registered User
    Join Date
    06-17-2009
    Location
    Edmonton, Alberta
    MS-Off Ver
    Excel 2007
    Posts
    19

    worksheet_change to insert row's when needed

    Hi, I am relatively new at coding in Excel and don't have much of an idea of where to start with what I need done.

    Basically, I want to have rows where I enter data that have costs associated with them. As such I want to have a total row at the bottom of the spreadsheet that sums the costs from the above rows. However some people may have more data than others but I still want to have the total row just below the last line of people entering data.

    I have figured out that to do this I need to use a Worksheet_change event. I have also gotten it to add a line below cell A15 when something is typed in A15 using this code:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Address = "$A$15" Then

    Call mymacro

    End If

    End Sub


    However once this is done and I begin to type in the newly created line it will not add another line below this like it did for A15.

    Is there some possible way to set this up so that as I move down the sheet adding lines it will continually insert more rows as each additional row is typed in?




    I was thinking that maybe it would have to be linked to the total cell/row. somehting like 'if(cell above total line=blank,do nothing,else - insert row)'...I just have no idea how to code this into an event.

    Any help would be appreciated

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: worksheet_change to insert row's when needed

    Please take a few minutes to read the forum rules, and then edit your post to add code tags.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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