|
A2 以下の製造コードをダブルクリックするだけで、折れ線グラフを作る
というのはどうかな ?
以下のイベントマクロをシートモジュールに入れて下さい。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Dim XVR As Range, VR As Range
Dim Nm As String
If Intersect(Target, Range("A2", Range("A65536").End(xlUp))) Is _
Nothing Then Exit Sub
Set XVR = Range("C1", Range("IV1").End(xlToLeft))
Set VR = XVR.Offset(Target.Row - 1)
Nm = Target.Offset(, 1).Text
Application.ScreenUpdating = False
With Charts.Add(After:=ActiveSheet)
.ChartType = xlLineMarkers
.HasLegend = False
With .SeriesCollection.NewSeries
.XValues = XVR
.Values = VR
End With
.SizeWithWindow = True
.Deselect
.Name = Nm
End With
Application.ScreenUpdating = True
Set XVR = Nothing: Set VR = Nothing
End Sub
|
|