ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Spell Check Protect Reprotect with same settings (https://www.excelbanter.com/excel-discussion-misc-queries/252885-spell-check-protect-reprotect-same-settings.html)

PatriciaT

Spell Check Protect Reprotect with same settings
 
Hello. I've been able to use below vb to spell check 'while protected'. My
issue is that i want to allow the user to be able to formatt columns and rows
(resize). When i execute the macro it clears those check marks from
protection list. Hoping someone can advise. Thank you
------------
Requires VBA to unprotect the sheet, do the spellcheck then reprotect the
sheet.

Similar to.......

Sub Spell_Check()
ActiveSheet.Unprotect Password:="justme"
Cells.CheckSpelling SpellLang:=1033
ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub


Gord Dibben Excel MVP



Gord Dibben

Spell Check Protect Reprotect with same settings
 
Using the macro recorder will generally give you the code you need for
allowing elements when protection is enabled.

Try this................

Sub Spell_Check()
With ActiveSheet
.Unprotect Password:="justme"
.Cells.CheckSpelling SpellLang:=1033
.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True _
, AllowFormattingColumns:=True, AllowFormattingRows:=True, _
AllowInsertingColumns:=True, AllowInsertingRows:=True
.EnableSelection = xlNoRestrictions
End With
End Sub

For EnableSelection you have 3 properties. Edit to suit.

xlNoSelection
xlNoRestrictions
xlUnlockedCells


Gord Dibben MS Excel MVP

On Sat, 9 Jan 2010 14:39:02 -0800, PatriciaT
wrote:

Hello. I've been able to use below vb to spell check 'while protected'. My
issue is that i want to allow the user to be able to formatt columns and rows
(resize). When i execute the macro it clears those check marks from
protection list. Hoping someone can advise. Thank you
------------
Requires VBA to unprotect the sheet, do the spellcheck then reprotect the
sheet.

Similar to.......

Sub Spell_Check()
ActiveSheet.Unprotect Password:="justme"
Cells.CheckSpelling SpellLang:=1033
ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub


Gord Dibben Excel MVP




All times are GMT +1. The time now is 12:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com