|
-
Apr 16th, 2002, 01:37 PM
#1
Excel2K Protection (VBA)
In Excel 2000, I want to protect a sheet to prevent changes other then cells that I leave unlocked. The only thing is, my coworkers need to be able to highlight cells with different colors. But with the sheet protected they can't, even on the unlocked cells. Is there anyway around this, or a certain way to protect it and still allow highlighting?
-
Apr 16th, 2002, 09:43 PM
#2
The highlight would be part of the content, so you would have to unprotect content for all cells to allow the highlight. I'd write a function to unprotect the sheet, highlight the cell, then protect the sheet again. Write a sub for each color and put the macros on a toolbar. That way your users can just click on the color they want and it highlights it for them and locked cells can't be highlighted. Something like this:
VB Code:
Sub Pink()
HighlightCell 7
End Sub
Function HighlightCell(ByVal sglColor As Single)
If ActiveCell.Locked Then
MsgBox "Cell is locked."
Else
ActiveSheet.Unprotect
ActiveCell.Interior.ColorIndex = sglColor
ActiveSheet.Protect
End If
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|