Option Explicit
Sub ガントチャート描画()
Dim c As Range
Dim org As Range
Dim dst As Range
For Each c In Range("D8:D20")
If c.Value <> "" Then
Set org = Range("F5:AJ5").Find( _
What:=c.Value, LookAt:=xlWhole)
Set dst = Range("F5:AJ5").Find( _
What:=c.Offset(0, 1).Value, LookAt:=xlWhole)
With ActiveSheet.Shapes.AddLine(org.Left + 0, _
c.Top + 7, dst.Left + 0, c.Top + 7).Line
.EndArrowheadStyle = msoArrowheadTriangle
.ForeColor.RGB = RGB(0, 0, 128)
.Weight = 3
End With
End If
Next
End Sub
Sub ガンチャート削除()
Dim sh As Shape
For Each sh In ActiveSheet.Shapes
If sh.Type = msoLine Then
sh.Delete
End If
Next
End Sub