spell check a protected sheet

donh

Board Regular
Joined
May 7, 2002
Messages
151
We have a protected worksheet that users need to be able to spell check for only specific cells that they input consisting of merged cells. We only want spell checking for certain cells because if spell check went for the whole worksheet it would pick up a few of the protected areas and suggest spelling for them which we don't want changed.

for these cells:
A50, A59, A71, A80, A92, A101, A113, A122, A129, A132, A138, A141, A144, A147, A150, A153, A156, A159, A174, A177

We currently have a button macro set up to email the worksheet when they finish entering their data - - - is there a way to spell check first then either:

---add to the current email macro to spell check to those specific cells and after you get the "The spelling check is complete for the selected cells" or "entire sheet" box to finish the macro and email

or

---set up a button macro to enable spell check for only those specific cells

spelling language is English (U.S.) (is it possible to have excel highlight the misspelling???)

we have not set up a range and would prefer not to so we would like for it to go cell by cell listed above

from reading through the message board it looks like we will be using Cells.CheckSpelling

so maybe something like if len(A50)>0 then spell check once ok then if len(A59)>0 then spell check . . .

We have limited vba skills :-)

Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try this:
Code:
Sub CheckSpelling(r As Range)
    ' shg 2009
    ' formats misspelled words in r red
 
    Dim cell        As Range
    Dim asWd()      As String
    Dim iWd         As Long
    Dim iPos        As Long
 
    With Application.SpellingOptions
        .IgnoreCaps = True
        .IgnoreFileNames = True
        .IgnoreMixedDigits = True
        ' .UserDict = ??     ' got one?
    End With
 
    For Each cell In r
        With cell
            If Not .HasFormula And VarType(.Value) = vbString Then
                asWd = Split(Replace(.Value, Chr(160), " "), " ")
                iPos = 1
                .Font.ColorIndex = xlColorIndexAutomatic
                For iWd = 0 To UBound(asWd)
                    If Not Application.CheckSpelling(Word:=asWd(iWd)) Then
                        .Characters(iPos, Len(asWd(iWd))).Font.ColorIndex = 3
                    End If
                    iPos = iPos + 1 + Len(asWd(iWd))
                Next iWd
            End If
        End With
    Next cell
End Sub
E.g.,
Code:
CheckSpelling Range("A50,A59,A71,A80,A92,A101,A113,A122,A129,A132,A138,A141,A144,A147,A150,A153, A156,A159,A174,A177")
 
Upvote 0
I came up with this - - - found out that if you select each cell then you can see the words that need fixed - - - can I use your's to still highlight the word that needs correcting???

Code:
    ActiveSheet.Unprotect
    
        With Application.SpellingOptions
        .UserDict = "CUSTOM.DIC"
        .IgnoreCaps = False
        .IgnoreMixedDigits = False
 
    Range("A50:F50").Select
    Selection.CheckSpelling SpellLang:=1033
        
    Range("A59:F59").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A71:F71").Select
    Selection.CheckSpelling SpellLang:=1033
        
    Range("A80:F80").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A92:F92").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A100:F101").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A112:F113").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A121:F122").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A129:F130").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A132:F133").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A138:F139").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A141:F142").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A144:F145").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A147:F147").Select
    Cells.CheckSpelling SpellLang:=1033
    
    Range("A147:F148").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A150:F151").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A153:F154").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A156:F157").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A159:F160").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A174:F175").Select
    Selection.CheckSpelling SpellLang:=1033
    
    Range("A177:F178").Select
    Selection.CheckSpelling SpellLang:=1033
    
    End With
    
    Range("B5:D5").Select
    
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
        , AllowFiltering:=True

End Sub
 
Upvote 0

Forum statistics

Threads
1,223,931
Messages
6,175,465
Members
452,646
Latest member
tudou

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top