Hi all
I have an excel worksheet that has several buttons made that when pressed runs a macro (to change the colour and size of text in cells when the cell is highlighted). This works fine when the sheet is locked and the right options are selected from the "protect sheet" menu.
I have discovered that the spellcheck is disabled when a worksheet is protected so I have found a macro that when runs uses my worksheet password to unlock the sheet, run spellcheck and then re-lock the worksheet. This works fine as well. This is the code...
The thing I have discovered is that when the spellcheck macro runs and unlocks and then re-locks the worksheet it also resets the "protect sheet" menu - not selecting the original settings and therefore not letting the cells to be formatted and the macros mentioned above to run.
Has anyone else encountered this and is there a workaround? Or do I just have to realise that if I lock the worksheet I cant have spellcheck.
Thanks all
T
I have an excel worksheet that has several buttons made that when pressed runs a macro (to change the colour and size of text in cells when the cell is highlighted). This works fine when the sheet is locked and the right options are selected from the "protect sheet" menu.
I have discovered that the spellcheck is disabled when a worksheet is protected so I have found a macro that when runs uses my worksheet password to unlock the sheet, run spellcheck and then re-lock the worksheet. This works fine as well. This is the code...
VBA Code:
Sub SpellCheckCell()
'Lock sheet spellcheck
With ActiveSheet
.Unprotect ("pass")
.Range("D5:D250").CheckSpelling
.Protect ("pass")
MsgBox "Spell Check Complete"
End With
End Sub
The thing I have discovered is that when the spellcheck macro runs and unlocks and then re-locks the worksheet it also resets the "protect sheet" menu - not selecting the original settings and therefore not letting the cells to be formatted and the macros mentioned above to run.
Has anyone else encountered this and is there a workaround? Or do I just have to realise that if I lock the worksheet I cant have spellcheck.
Thanks all
T
Last edited: