+ Reply to Thread
Results 1 to 4 of 4

update formula when row inserted

Hybrid View

ktchegi update formula when row... 04-06-2007, 03:16 AM
Bryan Hessey Hi, to insert a row, Sub... 04-09-2007, 06:19 PM
ktchegi Just to clarify a bit more 04-10-2007, 01:30 AM
ktchegi I may have solved this... 04-10-2007, 02:38 AM
  1. #1
    Registered User
    Join Date
    04-03-2007
    Posts
    16

    update formula when row inserted

    I am attaching 2 worksheets. In example 2, thanks to excellent advice from this forum, I am able to update the results in the last 3 columns if I insert groups of 3 cols. Same applies if I remove cols.
    My question is with "example" I have results on the right side of the worksheet. If I insert a row, is there some way of automatically updating the results to reflect the new row data? This would have to happen each time I insert a new row.
    Attached Files Attached Files
    Last edited by ktchegi; 04-06-2007 at 04:42 AM. Reason: wrong title

  2. #2
    Forum Contributor
    Join Date
    03-13-2005
    Posts
    6,195
    Quote Originally Posted by ktchegi
    I am attaching 2 worksheets. In example 2, thanks to excellent advice from this forum, I am able to update the results in the last 3 columns if I insert groups of 3 cols. Same applies if I remove cols.
    My question is with "example" I have results on the right side of the worksheet. If I insert a row, is there some way of automatically updating the results to reflect the new row data? This would have to happen each time I insert a new row.
    Hi,

    to insert a row,
    Sub InsertVolRow()
    Dim iRow As Long, iColumn As Long
        On Error GoTo Exit_Error
        iRow = Application.WorksheetFunction.Match("Total", Range("A:A"), 0)
        Rows(iRow).Select
        Selection.Insert Shift:=xlDown
        iColumn = Application.WorksheetFunction.Match("Total", Range("2:2"), 0)
        Cells(iRow - 1, 1).Select
        Selection.AutoFill Destination:=Range(Cells(iRow - 1, 1), Cells(iRow, 1)), Type:=xlFillDefault
        Range(Cells(iRow - 1, iColumn), Cells(iRow - 1, iColumn + 2)).Select
        Selection.AutoFill Destination:=Range(Cells(iRow - 1, iColumn), Cells(iRow, iColumn + 2)), Type:=xlFillDefault
        GoTo Exit_Sub
    Exit_Error:
        MsgBox "Error encountered - check for words 'Total'"
    Exit_Sub:
        If iRow < 4 Then iRow = 4
        Cells(iRow, 2).Select
    End Sub
    set that as a macro, and use macro Options to set a Shortcut Key, the new row will be inserted before the Total row, and details from A and the three Total columns should copy down.

    hth
    ---
    Si fractum non sit, noli id reficere.

  3. #3
    Registered User
    Join Date
    04-03-2007
    Posts
    16

    Just to clarify a bit more

    Once again, thanks. However, I would like to add some info. In my "example" I have data in T19 (56) which reflects in AG11 as same. I now insert a row and feed in data at T20 (lets say 10) which I want to show in AG11 as "10". The area in my worksheet AD2 to AH12 is used to update info only for each row as it is inserted. Have a good day
    I have not failed. I've just found 10,000 ways that won't work.

  4. #4
    Registered User
    Join Date
    04-03-2007
    Posts
    16

    Thumbs up I may have solved this...

    OK, it seems that the OFFSET function works. If I set AG2 as "=OFFSET(B20,-1,0)" and AH2 as "=OFFSET(C20,-1,0)" then AG3 as "=OFFSET(D20,-1,0)" etc I get the desired result when I insert rows.
    Thanks for an "excel"lent forum

+ 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