I am protecting my entire workbook (i.e. 5 sheets) with VBA. However, there is one section of one sheet that I would like users to be able to format (specifically highlight/fill).
For the sheet in question - 'Comps' - I have these lines of code in the ThisWorkbook module:
Sheets("Comps").Protect Password:="123", _
UserInterFaceOnly:=True, AllowFormattingCells:=True
But this allows formatting for the entire sheet. Using some code I saw elsewhere, I tried adding this - note the range I want to allow formatting for - but it didn't work.
Sheets("Computers").Range("CD4.DE26").Locked = False
Moreover, this code suggests to me that the cells are completely unlocked, which will allow deleting/typing etc. I ONLY want selecting & formatting as the options (it's a wordsearch, and I want the user to be able to highlight the letters).
Is there a way to do this?
Thanks!
For the sheet in question - 'Comps' - I have these lines of code in the ThisWorkbook module:
Sheets("Comps").Protect Password:="123", _
UserInterFaceOnly:=True, AllowFormattingCells:=True
But this allows formatting for the entire sheet. Using some code I saw elsewhere, I tried adding this - note the range I want to allow formatting for - but it didn't work.
Sheets("Computers").Range("CD4.DE26").Locked = False
Moreover, this code suggests to me that the cells are completely unlocked, which will allow deleting/typing etc. I ONLY want selecting & formatting as the options (it's a wordsearch, and I want the user to be able to highlight the letters).
Is there a way to do this?
Thanks!