Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Macro to Spell Check, Protect and Retain Protection Rules (Excel) Hi, I\'m runni

ID: 3565425 • Letter: M

Question

Macro to Spell Check, Protect and Retain Protection Rules (Excel)

Hi,

I'm running Excel 2010 and I have a number of sheets protected. When protecting the sheet I have the following options selected.

The "Format Cells" option is really just to allow the users to merge cells together.

I have a button Macro running a sspell check, which works greeat. However once the button has been pressed the user can no longer merge the cells.

When i go back into Protect Sheet I notice the "Format Cells" box is uun-ticked. The code for the spell check is the one below:

Sub Button2_Click()
ActiveSheet.Unprotect Password:="password"
Cells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, AlwaysSuggest:=True, SpellLang:=2057 '1033
ActiveSheet.Protect Password:="password"
End Sub

Can someone help me with a piece of code that allows the Format Cells box to remain ticked after the spell check has been completed pleease?

Many Thankss,

Explanation / Answer

Hi ...

Not a VBA expert either ;-). It looks like you forgot the comma beforee AllowFormattingCells:=True and reading my post that's my fault :-( - sincere apologiees

Have a look to the line of code above ActiveSheet.Protect... Parameters are separated by commas and as far as I know there is no exception to this in VBA when functions are called.

Hope this helpss

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote