線を描画する際に線に名前を着けて個別に管理しようと思ったのですが、
.Name = i.ToString()の部分で引っかかっているみたいで、理由が分かりません。何が問題なのでしょうか?
ちなみに.Name = i.ToString()を消すと、線が描画されます。
'スコアを読み取って線を描画
Function DrawGraph(str As Integer, ParamArray scores()) As String
Dim i As Integer
Dim yjiku As Integer
Dim yjiku2 As Integer
'線を消す
For Each sh In Application.Worksheets("Sheet3").Shapes
If sh.Type = msoLine Then
sh.Delete
End If
Next
If UBound(scores) >= 2 Then
For i = 0 To UBound(scores) - 1
yjiku = ScoreGraph(scores(i))
yjiku2 = ScoreGraph(scores(i + 1))
Application.Worksheets("Sheet3").Shapes.AddLine(Application.Worksheets("Sheet3").Cells(yjiku, Application.ThisCell.Column + i * 2).Left, Application.Worksheets("Sheet3").Cells(yjiku, Application.ThisCell.Column + i * 2).Top, Application.Worksheets("Sheet3").Cells(yjiku2, Application.ThisCell.Column + (i * 2 + 2)).Left, Application.Worksheets("Sheet3").Cells(yjiku2, Application.ThisCell.Column + (i * 2 + 2)).Top).Select
With Selection.ShapeRange.Line
.Visible = msoTrue
.Weight = 1.5
.ForeColor.ObjectThemeColor = msoThemeColorText1
.Name = i.ToString() ←ここでダメっぽい
End With
Next
End If
DrawGraph = ""
End Function
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。