(Solved) – Why does my Excel table multiply columns when I insert/delete rows?

(solved)-–-why-does-my-excel-table-multiply-columns-when-i-insert/delete-rows?

This Excel program have a table which have some columns which collects data from several master tables.

Using the code like so:

Private Sub worksheet_change(ByVal target As Range)

'Autofill Die Description after Die No is filled
'If Project No is not empty then do the following
If Not Intersect(target, Me.ListObjects("F.Main").ListColumns("Project No").DataBodyRange) Is Nothing Then

 With target.Offset(0, 1) '1 column to the right of Project No
    .FormulaR1C1 = "=IFerror(INDEX(D.Entry,MATCH(rc[-1],D.Entry[Project No],0),2),"""")"
    .Value = .Value
 End With

 With target.Offset(0, 2)
    .FormulaR1C1 = "=IFerror(INDEX(D.Entry,MATCH(rc[-2],D.Entry[Project No],0),3),"""")"
    .Value = .Value
 End With

 With target.Offset(0, 3)
    .FormulaR1C1 = "=IFerror(INDEX(D.Entry,MATCH(rc[-3],D.Entry[Project No],0),4),"""")"
    .Value = .Value
 End With

.

.

.

End If

When I try to insert or delete new rows in that table this happens:

enter image description here

What is causing this?

Leave a Reply

Your email address will not be published. Required fields are marked *