|
'ThisWorkbookモジュール
Option Explicit
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("Cell").Reset
End Sub
Private Sub Workbook_Open()
With Application.CommandBars("Cell")
With .Controls.Add(Type:=msoControlButton, Before:=1, Temporary:=True)
.Caption = "オートフィルタ"
.OnAction = "ThisWorkbook.filter"
End With
With .Controls.Add(Type:=msoControlButton, Before:=1, Temporary:=True)
.Caption = "ハイパーリンク"
.OnAction = "ThisWorkbook.hlink"
End With
End With
With Worksheets("チェックリスト")
.EnableAutoFilter = True
.Protect UserInterfaceOnly:=True
End With
End Sub
Private Sub filter()
On Error Resume Next
Range("A35:AD35").AutoFilter
End Sub
Private Sub hlink()
If ActiveCell.Locked Then
MsgBox "error"
Else
Application.Dialogs(xlDialogInsertHyperlink).Show
End If
End Sub
|
|