|
▼ABC さん:
んー・・では、
>50064に右クリックイベントで直線を引くコードの説明を見つけました。自分としては是非そのコードを参考にして
これを尊重して
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Dim l_rng As Range
Dim L As Single
Dim T As Single
Dim x As Single '■
If Target.Count <> 1 Then
MsgBox "単一セルに限ります"
Exit Sub
End If
If f_rng Is Nothing Then
Set f_rng = Target
Application.StatusBar = "直線の終点を右クリックしてください"
Else
If f_rng.Address = Target.Address Then '■
Set l_rng = Target '■
x = l_rng.Height / 2 '■
ElseIf f_rng.Left > Target.Left Then '■
Set l_rng = f_rng
Set f_rng = Target
Else
Set l_rng = Target
End If
With Me.Lines.Add(f_rng.Left + f_rng.Width, f_rng.Top + x, _
l_rng.Left, l_rng.Top + x) '■
.ShapeRange.Line.Weight = 0.5
.Height = 0
L = .Left + .Width / 2
T = .Top
End With
With Me.TextBoxes.Add(L - 8, T, 16, 16)
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
Set f_rng = Nothing
Application.StatusBar = False
End If
Cancel = True
End Sub
この程度で。
■が修正箇所です。
|
|