
Active Member

August 10, 2016

I have applied the code below to VBA to activate the Spell Check feature on a protected worksheet. My issue is when the code turns the protection back on, it does not capture the attributes attached to the original protection; i.e. the ability to insert or delete rows and columns which is key to this particular worksheet.
The code is;
Sub SpellCheck()
Application.ScreenUpdating = False
On Error Resume Next
With ActiveSheet
.Unprotect ("*****")
Selection.CheckSpelling
.Protect ("*****")
End With
Application.ScreenUpdating = True
End Sub
Thanks,
Prescott


June 30, 2016

Hello
May be this piece of code would be useful for you
Dim myPassword As String
myPassword = "123"
'Protect Worksheet (Allow Formatting Columns)
ActiveSheet.Protect Password:=(myPassword), AllowFormattingColumns:=True
'Protect Worksheet (Allow Formatting Rows)
ActiveSheet.Protect Password:=(myPassword), AllowFormattingRows:=True
'Protect Worksheet (Allow Formatting Columns & Rows)
ActiveSheet.Protect Password:=(myPassword), AllowFormattingColumns:=True, AllowFormattingRows:=True
End Sub

Answers Post
1 Guest(s)
