Hey everyone, I'm trying to protect all cells in a sheet based on this color --
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Based off of this color, I am trying to protect all other cells that are not that color by using the .TintAndShade. The code I am using is --
Dim ProtectCell As Range
For Each ProtectCell In ActiveSheet.UsedRange
If ProtectCell.Interior.TintAndShade = -0.149998474074526 Then
ProtectCell.Locked = False
Else
ProtectCell.Locked = True
End If
Next ProtectCell
But it is not working. No line of the code hits the "ProtectCell.Locked = False line, it only hits the True portion everytime. Does anyone know what I am doing wrong?
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = -0.149998474074526
.PatternTintAndShade = 0
End With
Based off of this color, I am trying to protect all other cells that are not that color by using the .TintAndShade. The code I am using is --
Dim ProtectCell As Range
For Each ProtectCell In ActiveSheet.UsedRange
If ProtectCell.Interior.TintAndShade = -0.149998474074526 Then
ProtectCell.Locked = False
Else
ProtectCell.Locked = True
End If
Next ProtectCell
But it is not working. No line of the code hits the "ProtectCell.Locked = False line, it only hits the True portion everytime. Does anyone know what I am doing wrong?