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!![]()
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!![]()
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
>
>
These cell have values... is there a way to protect them too?![]()
ok, lets say: I have a table with the days of a month (obtained by formula).
Some days are weekend or hollidays. These particular cells have a background fill.
This worksheet is to set holliday periods for employees. So I don't want to select Christmas or other hollidays, got it?
So these cells with numbers should be protected, but not for edition, because of the background fill change!
Is this possible?
No I don't got it. I gave you what you asked for. It is unclear how your
additional information has changed that. The only addendum I would add, is
if the sheet is static, you certainly don't need a macro to do this. Set it
up manually and be done with it.
--
Regards,
Tom Ogilvy
"jobeer" wrote:
>
> These cell have values... is there a way to protect them too?
>
>
> ok, lets say: I have a table with the days of a month (obtained by
> formula).
> Some days are weekend or hollidays. These particular cells have a
> background fill.
> This worksheet is to set holliday periods for employees. So I don't
> want to select Christmas or other hollidays, got it?
>
> So these cells with numbers should be protected, but not for edition,
> because of the background fill change!
>
> Is this possible?
>
>
> --
> jobeer
> ------------------------------------------------------------------------
> jobeer's Profile: http://www.excelforum.com/member.php...o&userid=32447
> View this thread: http://www.excelforum.com/showthread...hreadid=523145
>
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks