| 
    
     |  | Public WithEvents WBK As Workbook Public WithEvents App As Application
 Private Sub App_SheetActivate(ByVal Sh As Object)
 
 If フラグ <> 1 Then
 If Sh.Type = xlWorksheet And Sh.ProtectContents = False Then
 WBK_SheetSelectionChange ActiveSheet, Selection
 Else
 ShiyoKa False
 End If
 End If
 
 End Sub
 Private Sub App_WorkbookActivate(ByVal Wb As Workbook)
 
 InitializeBook WBook:=Wb
 App_SheetActivate ActiveSheet
 
 End Sub
 Private Sub App_WorkbookDeactivate(ByVal Wb As Workbook)
 
 ShiyoKa False
 
 End Sub
 Private Sub WBK_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Range)
 
 If (ThisWorkbook.Name = "ピカつーる.xla") And (Sh.ProtectContents = False) Then
 ShiyoKa True
 With Application.CommandBars("Cell")
 With .Controls(11)
 If .BuiltIn = False Then .Enabled = True
 End With
 End With
 With Application.CommandBars("オリジナル書式設定")
 If Target.VerticalAlignment = xlBottom Then
 .Controls(12).State = msoButtonDown
 ElseIf Target.VerticalAlignment = xlCenter Then
 .Controls(13).State = msoButtonDown
 ElseIf Target.VerticalAlignment = xlTop Then
 .Controls(14).State = msoButtonDown
 End If
 End With
 Else
 ShiyoKa False
 With Application.CommandBars("Cell")
 With .Controls(11)
 If .BuiltIn = False Then .Enabled = False
 End With
 End With
 End If
 
 If Application.CutCopyMode = xlCopy Then
 With Application.CommandBars("Cell")
 With .Controls(7)
 If .BuiltIn = False Then .Enabled = True
 End With
 End With
 Else
 With Application.CommandBars("Cell")
 With .Controls(7)
 If .BuiltIn = False Then .Enabled = False
 End With
 End With
 End If
 
 End Sub
 
 
 |  |