Thanks
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 14 Or Target.Columns.Count > 1 Then Exit Sub If the target column is not equal to 14 or the target column If the number is greater than 1, exit
Application.ScreenUpdating = False Turn off screen refresh
Application.EnableEvents = False Turn off events
Dim nRow%, i% define nrow The two variables i and i are integers
Dim BeginR As Range, EndR As Range Define beginr and endr as range
nRow = Range("n65536").End(xlUp).Row nrow=Number of recorded rows
Set BeginR = Range("b2").Offset(0, Range("n2" ))
If Me.Shapes.Count > 0 Then 'Delete existing shapes
Me.Shapes.SelectAll
Selection.Delete
End If
Range("B2: K" & nRow).FillDown
For i = 3 To nRow '
Set EndR = Range("b" & i).Offset(0, Range("n" & i))
'Draw lines
Set DrawLine = Me.Shapes.AddLine(BeginR.Left + BeginR.Width / 2, _
BeginR.Top + BeginR.Height / 2, EndR.Left + EndR.Width / 2, _
EndR.Top + EndR.Height / 2).Line
Set BeginR = EndR p>
Next
ActiveSheet.DrawingObjects.ShapeRange.Group
With ActiveSheet.DrawingObjects.ShapeRange.Line
.DashStyle = msoLineSolid
.Weight = 1.5
.ForeColor.SchemeColor = 12
End With
Application.EnableEvents = True Open and close stuff
Application.ScreenUpdating = True
Set BeginR = Nothing Clear variables
Set EndR = Nothing
End Sub