Spell Check a protected sheet?

weefisheads

Active Member
Joined
Mar 18, 2006
Messages
351
This should be a very easy question -

Is it possible to protect a sheet and still have the option to Spell check unlocked cells?

I've tried a number of options, but it seems that anytime I protect a sheet, the F7 Spelling options gets greyed out.

I don't want folks to spell check LOCKED cells, but it would be nice to spell check text in unlocked cells.

Possible?

dB
 

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.
Hi dB,

Your best bet is to use a macro. You can assign it to a button, or have the user open the Macros window to run it. (In 2007, if you know how, you can create a custom toolbar icon or add it to the QAT.)
Code:
Sub spellchk()
Sheets("Sheet1").Unprotect Password:="your_password"
Range("A1, A3, A5").CheckSpelling
Sheets("Sheet1").Protect Password:="your_password"
End Sub
Add the addresses of your unprotected cells to the Range entry list, change your sheet name, and the password of course.
 
Upvote 0
dB,

I have used this code for highlighting the unlocked cells.

Code:
Sub SelectAllUnlockedCells()
    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.Select
    End If
End Sub

You could possibly use this if there is many unlocked cells that you would like to be available for spell check.

This sould be worked into mvptomlinson's code.

Darren
 
Upvote 0
Maybe something like

Code:
Sub SpellCheckAllUnlockedCells()
 
ActiveSheet.Unprotect
      'Alternatively use something like
      'Sheets("Sheet1").Unprotect Password:="your_password"
      'if there is a password.  Also if not just the ActiveSheet
 
    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.Select
    End If
Selection.CheckSpelling
ActiveSheet.Protect
     'Alternatively use something like
     'Sheets("Sheet1").Protect Password:="your_password"
     'if there is a password.  Also if not just the ActiveSheet
 
End Sub

Or better

Code:
Sub SpellCheckAllUnlockedCells()
 
ActiveSheet.Unprotect
     'Alternatively use something like
     'Sheets("Sheet1").Unprotect Password:="your_password"
     'if there is a password.  Also if not just the ActiveSheet
 
Call SelectUnlockedCells
Selection.CheckSpelling
ActiveSheet.Protect
     'Alternatively use something like
     'Sheets("Sheet1").Protect Password:="your_password"
     'if there is a password.  Also if not just the ActiveSheet
 
End Sub
Sub SelectUnlockedCells()
    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.Select
    End If
End Sub
if you think you may want to select all unlocked cells for some other task.

Darren
 
Upvote 0
Thanks all for the reply - both suggestions work like a charm.

AusSteelMan, I do have one question though. After running your code, all Non protected cells are still selected. Short of coming up with a specific cell to select, is there any way to UNSELECT all ranges that are selected? I saw somewhere that Set WorkRange = Nothing does something like this, but that doesn't seem to work for me.

Regardless, I really appreciate the code.

dB
 
Upvote 0
Sorry, but I do not know of a way to simply deselect cells. I think that "something" needs to be the currently selected active cell.

My only suggestions would be to:
1. alter the code so that whatever was the selected cell before the code was executed was then reselected just before the end of the code (so basically the user would never anything happen except the spell check box popping up)
2. alter the code to select a cell to finish on each time.

Maybe someone else has an idea.

Regards,
Darren
 
Upvote 0
If you use UserInterfaceOnly protection, you can spell-check to your hearts content on a protected sheet. But be aware that, to use UserInterfaceOnly protection effectively, you must deal with the fact that you have to re-establish it every time the workbook is opened. For an excellent article on protection in general and UserInterfaceOnly protection in particular, see Chip Pearson's page: Worksheet And Workbook Protection
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,394
Members
448,957
Latest member
Hat4Life

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