'(参照)『保護をした後にセルの塗りつぶしの色を変えたい』(くどう)
'http://www.excel.studio-kazu.jp/kw/20050615120953.html
'Excel2013のマクロの記録で作成しました。
Sub aaa_Excelのロックしたセルを塗りつぶし()
ActiveSheet.Unprotect
Range("A1").Select
Cells.Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=CELL(""protect"",A1)=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0.799981688894314
End With
Selection.FormatConditions(1).StopIfTrue = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _
AllowDeletingRows:=True
Range("A1").Select
ActiveSheet.Protect
End Sub
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00