
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
---
Bookmarks