View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.misc
Dorci Dorci is offline
external usenet poster
 
Posts: 29
Default Spell Check Unlocked Cells Only

I discovered a problem with the code. When it protects the sheet at the end,
it doesn't keep all of the protection settings it had originally. The
original settings allow users to (1) select locked cells, (2) select unlocked
cells, (3) format cells, (4) format columns, (5) format rows. After the
spell check, the only options set are (1) and (2).

Can I specify the settings in the ActiveSheet.Protect command?

Thanks!

"Gord Dibben" wrote:

Try this change............

For Each rng In ActiveSheet.UsedRange


Gord Dibben MS Excel MVP


On Tue, 21 Jul 2009 12:20:01 -0700, Dorci
wrote:

Any idea why I would get theerror "Object required" when I insert the code
below?

"Jim Thomlinson" wrote:

Sub test()
Dim rngUnlocked As Range
Dim rng As Range

For Each rng In UsedRange
If rng.Locked = False Then
If rngUnlocked Is Nothing Then
Set rngUnlocked = rng
Else
Set rngUnlocked = Union(rng, rngUnlocked)
End If
End If

Next rng

ActiveSheet.Unprotect

rngUnlocked.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True

ActiveSheet.Protect

End Sub

--
HTH...

Jim Thomlinson


"Dorci" wrote:

Sorry, I was rushed -- I misspelled Excel and didn't post an actual question.
Is there a way to specify "only unlocked cells" in the following spell check
code?

ActiveSheet.Unprotect

Cells.CheckSpelling _
CustomDictionary:="CUSTOM.DIC", _
IgnoreUppercase:=False, _
AlwaysSuggest:=True

ActiveSheet.Protect