|
セル選択イベントだと、ちょっと頻繁に発生しすぎるので、適切ではないように
思います。私なら右クリックイベントに変えて
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, _
Cancel As Boolean)
Dim AcPro1 As String, AcPro2 As String
Dim Cap1 As String, Cap2 As String
Cancel = True
Select Case Target.Interior.ColorIndex
Case 24
AcPro1 = "model_11": AcPro2 = "model_12"
Cap1 = "道具L字追加": Cap2 = "道具T字追加"
Case 35
AcPro1 = "model_31": AcPro2 = "model_32"
Cap1 = "コネクタ横伸長": Cap2 = "コネクタ縦伸長"
Case Else
AcPro1 = "": AcPro2 = ""
Cap1 = "": Cap2 = ""
End Select
With ActiveSheet.Shapes("Button 8")
.OnAction = AcPro1: .Characters.Text = Cap1
End With
With ActiveSheet.Shapes("Button 9")
.OnAction = AcPro2: .Characters.Text = Cap2
End With
End Sub
|
|