Macro help

  • Thread starter Thread starter Whitney
  • Start date Start date
W

Whitney

I'm new to macros, could some explain how I can use this macro to allow spell
check when a sheet is protected?

Using a macro is the only work around that I know of.

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

Unprotects the sheet, does the spellcheck then reprotects the sheet.

"justme" can be changed to your password.


Gord Dibben MS Excel MVP
 
You have to initiate it somehow. Most likely by creating command button. Go to

View--> Toolbars --> Forms

Then click on the command button icon and when it opens up attach the macro
to it. So now when you click it, it will run the macro.
 
Ok, I tried it and it seems to be working, however how do I limit it to just
the unlocked cells that data is entered into and not the locked cells.

For example:
A1 has Cons Name
B1 user enters the cons name

I only want it to spell check B1
 
Maybe something like

Sub Spell_Check()
Dim c As Range
On Error GoTo Cleanup
Application.ScreenUpdating = False
ActiveSheet.Unprotect Password:="justme"
For Each c In ActiveSheet.UsedRange
If c.Locked = False Then
c.CheckSpelling SpellLang:=1033
End If
Next c
ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
Cleanup:
Application.ScreenUpdating = True
End Sub

Hope this helps,

Hutch
 
Are you sure it didn't work? Were there any mis-spelled words for it to find?
When I tested this code , I put garbage text (non-words) and okay words in
both the unlocked and locked cells, with the sheet unprotected. Then I
protected the sheet and ran the macro. It showed me suggested corrections
only for the garbage text in the unlocked cells.

Hutch
 
I think it might be the way my sheet is set up. It corrects a few cells, but
when it gets to a certain point, the screen just starts flashing and nothing
happens after that.
 
If you want to send me your workbook (with any confidential or sensitive
information removed), I will take a look at it. My email address is
hutch99999<remove this>@yahoo<also this>.com

Hutch
 
Back
Top