ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Turning Colored Cell's Off (https://www.excelbanter.com/excel-programming/285871-turning-colored-cells-off.html)

JAD[_3_]

Turning Colored Cell's Off
 
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

Tom Ogilvy

Turning Colored Cell's Off
 
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

--
Regards,
Tom Ogilvy


"JAD" wrote in message
...
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





All times are GMT +1. The time now is 02:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com