Turning Colored Cell's Off

  • Thread starter Thread starter JAD
  • Start date Start date
J

JAD

When I design a speadsheet, I use color to designate cells
that are protected from cells that are not. While I prefer
this method, others in the group would prefer a white
background on all worksheets. Is there a way to write a
macro which can toggle between both formats? In the past I
have written a macro that can accomplish this goal, but
required more lines of code since I did not know of a
simple multiple line code that could accomplish the same.
Any help would be appreciated. Thank You, JAD
 
Dim bTurnOnColor as Boolean
Dim cell as Range
ActiveSheet.Unprotect
bTurnOnColor = True
for each cell in Activesheet.UsedRange
if cell.locked then
if bTurnOnColor then
cell.Interior.ColorIndex = 5
else
cell.Interior.ColorIndex = xlNone
end if
End if
Next
Activesheet.Protect
 
Back
Top