Sub gachcheo()
'Xoa duong cheo cu
For Each shp In ActiveSheet.Shapes
If shp.Type = 1 Then
shp.Delete
End If
Next shp
'Xac dinh dong cuoi cung trong phan noi dung
Range("b19").Select
Do Until Len(ActiveCell) = 0
ActiveCell.Offset(1, 0).Select
Loop
If ActiveCell.Row < 28 Then
'Ke duong ngang
ActiveSheet.Shapes.AddConnector(1, ActiveCell.Offset(0, -1).Left, (ActiveCell.Top + ActiveCell.Offset(1, 0).Top) / 2, ActiveCell.Offset(0, 1).Left, (ActiveCell.Offset(0, 1).Top + ActiveCell.Offset(1, 0).Top) / 2).Select
With Selection.ShapeRange.Line
.Weight = 1
.ForeColor.ObjectThemeColor = msoThemeColorText1
End With
'Ke duong cheo
ActiveSheet.Shapes.AddConnector(1, ActiveCell.Offset(0, 1).Left, (ActiveCell.Offset(0, 1).Top + ActiveCell.Offset(1, 0).Top) / 2, Range("j21").Left, Range("j28").Top + Range("j28").Height).Select
With Selection.ShapeRange.Line
.Weight = 1
.ForeColor.ObjectThemeColor = msoThemeColorText1
End With
End If
End Sub