skippy0070
New Member
Hello,
I am not sure if this is in the right place but I am hoping someone may be able to help me solve a coding problem. The following code is for spell checking locked worksheets unlocked cells only and it works fine but does not identify the cell with the spelling error;
I am trying to insert the following line which identifies the cell with the error using the command bar tools but I am not very good with the VBA coding and just can’t figure it out;
I am trying it in place of;
It works okay but then I lose the ability to check only unlocked cells. Any ideas are greatly appreciated.
I am not sure if this is in the right place but I am hoping someone may be able to help me solve a coding problem. The following code is for spell checking locked worksheets unlocked cells only and it works fine but does not identify the cell with the spelling error;
Code:
Sub SelectUnlockedCells_Spellcheck()
ActiveSheet.Unprotect Password:=""
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:=""
End Sub
I am trying to insert the following line which identifies the cell with the error using the command bar tools but I am not very good with the VBA coding and just can’t figure it out;
Code:
CommandBars("Tools").Controls("Spelling...").Execute
I am trying it in place of;
Code:
FoundCells.CheckSpelling CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, AlwaysSuggest:=True, SpellLang:=3081
It works okay but then I lose the ability to check only unlocked cells. Any ideas are greatly appreciated.
Last edited by a moderator: