Spellcheck function in Protected Sheet
That is worksheet event code and I presume you have it in a sheet module.
It fires whenever you enter text into merged cells.
I misspoke in my first post.
You don't want to run spellcheck every time the event code fires so I would just
assign the Spell_Check macro to a button and run it whenever you choose.
Gord
On Thu, 25 Jan 2007 18:19:00 -0800, gwinder
wrote:
Gord....here's the code I have which is under Microsoft Excel Object, not a
module
So where would I put the spellcheck code? and how does a user activate the
spell check?
Thanks,
Gary
Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewRwHt As Single
Dim cWdth As Single, MrgeWdth As Single
Dim c As Range, cc As Range
Dim ma As Range
With Target
If .MergeCells And .WrapText Then
Set c = Target.Cells(1, 1)
cWdth = c.ColumnWidth
Set ma = c.MergeArea
For Each cc In ma.Cells
MrgeWdth = MrgeWdth + cc.ColumnWidth
Next
Application.ScreenUpdating = False
On Error Resume Next
ma.MergeCells = False
c.ColumnWidth = MrgeWdth
c.EntireRow.AutoFit
NewRwHt = c.RowHeight
c.ColumnWidth = cWdth
ma.MergeCells = True
ma.RowHeight = NewRwHt
cWdth = 0: MrgeWdth = 0
On Error GoTo 0
Application.ScreenUpdating = True
End If
End With
End Sub
"Gord Dibben" wrote:
Gary
Sub Spell_Check()
ActiveSheet.Unprotect Password:="justme"
Cells.CheckSpelling SpellLang:=1033
ActiveSheet.Protect Password:="justme", DrawingObjects:=True, _
Contents:=True, Scenarios:=True
End Sub
Where in your code would it go?
Can't see your code so have no idea.
I assume the word wrap code is event code. Right?
You could run it by calling from your current code.
Just insert the line Spell_Check at a point you feel is appropriate.
Place the Spell_Check macro in a general module.
Gord Dibben Excel MVP
On Thu, 25 Jan 2007 10:03:01 -0800, gwinder
wrote:
I have created an employee review form that contains code which enables text
wrap in merged cells. I have protected the sheet but this disables the
spellcheck functionality. I've seen some threads where you can insert code
to allow spellcheck to work but where in the code would this go? At the end
of my exisiting code? At the beginning?
Thanks,
Gary
|