|
▼今田 さん:
こんにちは。
解決...と思って油断してました(笑
とりあえずDoubleClickイベントにかえてみました。
Option Explicit
Dim flg As Boolean
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
CommandBars.FindControl(ID:=130).Execute
flg = True
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Lp As Single
Dim Tp As Single
Dim Wp As Single
Dim Hp As Single
If flg Then
With ActiveSheet
With .Lines(.Lines.Count)
Lp = .Left
Tp = .Top
Wp = .Width
Hp = .Height
End With
With .TextBoxes.Add(0, 0, 0, 0)
.ShapeRange.Line.Visible = msoFalse
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.AutoSize = True
.Font.Size = 10
.Text = Wp '仮
.Left = Lp + (Wp - .Width) / 2
.Top = Tp + (Hp - .Height) / 2
.Select
End With
End With
flg = False
End If
End Sub
|
|