• Source
    1. Option Explicit
    2.  
    3. Sub ガントチャート描画()
    4. Dim c As Range
    5. Dim org As Range
    6. Dim dst As Range
    7.  
    8. For Each c In Range("D8:D20")
    9. If c.Value <> "" Then
    10. Set org = Range("F5:AJ5").Find( _
    11. What:=c.Value, LookAt:=xlWhole)
    12. Set dst = Range("F5:AJ5").Find( _
    13. What:=c.Offset(0, 1).Value, LookAt:=xlWhole)
    14.  
    15.  
    16. With ActiveSheet.Shapes.AddLine(org.Left + 0, _
    17. c.Top + 7, dst.Left + 0, c.Top + 7).Line
    18. .EndArrowheadStyle = msoArrowheadTriangle
    19. .ForeColor.RGB = RGB(0, 0, 128)
    20. .Weight = 3
    21. End With
    22. End If
    23. Next
    24. End Sub
    25.  
    26.  
    27. Sub ガンチャート削除()
    28. Dim sh As Shape
    29.  
    30. For Each sh In ActiveSheet.Shapes
    31. If sh.Type = msoLine Then
    32. sh.Delete
    33. End If
    34. Next
    35. End Sub