View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Lock condition based on a background fill

in the Thisworkbook module, use the workbook_open event
http://www.cpearson.com/excel/events.htm

Private Sub Workbook_Open
with worksheets("sheet1")
set rng = .UsedRange
.Unprotect Password:="ABCD"
for each cell in rng
if cell.Interior.ColorIndex < xlNone then
cell.locked = True
end if
Next
.Protect Password:="ABCD"
End with
End Sub

--
Regards,
Tom Ogilvy


"jobeer" wrote:


Obviously an IF condition, but my knowledge ends here...

All I need is a condition that lock all cells in a worksheet, that has
a background fill. That condition should be activate when opening
workbook

Seems easy, no?

Thanks, ppl! :)


--
jobeer
------------------------------------------------------------------------
jobeer's Profile: http://www.excelforum.com/member.php...o&userid=32447
View this thread: http://www.excelforum.com/showthread...hreadid=523145