ksantos16
New Member
- Joined
- Jan 28, 2016
- Messages
- 3
I have a worksheet on which I need to protect specific cells, yet allow for the users to have all the permissions on the "Protect Sheet" screen, with the exception of anything to do with columns. I also need to allow the users to do a spell check, which gets locked when the sheet is protected. I found a macro that allowed the sheet to be unprotected and protected as part of the macro to allow the spell check to occur. The problem is, when the macro reprotects the sheet, it removes all the permissions except for the standard "select locked cells" and "select unlocked cells". Is there a way that I can have the permissions enabled with the macro?
Here is my macro:
Thank you in advance for any assistance!
Here is my macro:
Code:
Sub SelectUnlockedCells_Spellcheck()
ActiveSheet.Unprotect Password:="Asyst16"
Dim WorkRange As Range
Dim FoundCells As Range
Dim Cell As Range
Set WorkRange = ActiveSheet.UsedRange
For Each Cell In WorkRange
If Cell.Locked = False Then
If FoundCells Is Nothing Then
Set FoundCells = Cell
Else
Set FoundCells = Union(FoundCells, Cell)
End If
End If
Next Cell
If FoundCells Is Nothing Then
MsgBox "All cells are locked."
Else
FoundCells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, AlwaysSuggest:=True, SpellLang:=3081
End If
ActiveSheet.Protect Password:="Asyst16"
End Sub
Thank you in advance for any assistance!