View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ryguy7272 ryguy7272 is offline
external usenet poster
 
Posts: 2,836
Default VBA Check Spelling doesn't highlight misspelled word

I don't have time to modify the code right now, and it would be a little
difficult for me to do so because I don't have all those named ranges that
you have. Anyway, I think the macro will do what you want, once you change
it to look at the named ranges you specified. Or, just run it as is. How
much more time could it possible take to check cells that are not within the
named ranges, assuming there aren't lots and lots of spelling mistakes to
begin with.

HTH,
Ryan---


--
RyGuy


"TWhizTom" wrote:

Thanks Ryan,

However, I don't want to check the whole sheet, just the named ranges. I
have not tried your code, but it does not appear to check the named ranges
only.
--

Tech Whiz Tom
MS Access / Excel Applications Analyst


"ryguy7272" wrote:

If you care to correct errors as you go, either of these may work for you?

Sub SpellDown()
Do
ActiveCell.Offset(1, 0).Select
ActiveCell.CheckSpelling SpellLang:=1033, _
AlwaysSuggest:=True
On Error GoTo Right
Loop
Right:
ActiveCell.Offset(0, 1).Select
SpellUp
End Sub

Sub SpellUp()
Do
ActiveCell.Offset(-1, 0).Select
ActiveCell.CheckSpelling SpellLang:=1033, _
AlwaysSuggest:=True
On Error GoTo Right
Loop
Right:
ActiveCell.Offset(0, 1).Select
SpellDown
End Sub

HTH,
Ryan---

--
RyGuy


"TWhizTom" wrote:

I am spellchecking a range (based on the current active sheet name). The
range is multi-rowed, but single column. When user clicks check spelling, it
unprotects the sheet spell checks the range and re-protects the sheet.

The issue is with some of these ranges there are over 50 often 100 rows. A
user may not be able to figure out what their spelling mistake was because
the error is not highlighted, therefore, the context of the spelling error is
lost...

How can I activate the cell or highlight the misspelled word? Code Example
follows:

<code
Sub Spelling()
QuickUnprotect
Application.EnableEvents = False
Select Case ActiveSheet.Name
Case "Cover"
Range("Cover_SpellCheck").CheckSpelling
Case "FacilityData"
Range("Facility_CheckSpell").CheckSpelling
Case "4.0"
Range("QSR_SpellCheck").CheckSpelling
strHidden = Range("QSR_AuditorComments").EntireColumn.Hidden
Range("QSR_AuditorComments").EntireColumn.Hidden = False
Range("QSR_AuditorComments").CheckSpelling
Range("QSR_AuditorComments").EntireColumn.Hidden = True
Range("QSR_AuditorComments").EntireColumn.Hidden = strHidden
Range("QSR_4_2_Comment").Select
Case "5.0"
Range("Mgmt_Spellcheck").CheckSpelling
strHidden = Range("Mgmt_AuditorComments").EntireColumn.Hidden
Range("Mgmt_AuditorComments").EntireColumn.Hidden = False
Range("Mgmt_AuditorComments").CheckSpelling
Range("Mgmt_AuditorComments").EntireColumn.Hidden = True
Range("Mgmt_AuditorComments").EntireColumn.Hidden = strHidden
Case "6.0"
Range("Res_Spellcheck").CheckSpelling
strHidden = Range("Res_AuditorComments").EntireColumn.Hidden
Range("Res_AuditorComments").EntireColumn.Hidden = False
Range("Res_AuditorComments").CheckSpelling
Range("Res_AuditorComments").EntireColumn.Hidden = True
Range("Res_AuditorComments").EntireColumn.Hidden = strHidden
Case "7.0"
Range("Prod_Spellcheck").CheckSpelling
strHidden = Range("Prod_AuditorComments").EntireColumn.Hidden
Range("Prod_AuditorComments").EntireColumn.Hidden = False
Range("Prod_AuditorComments").CheckSpelling
Range("Prod_AuditorComments").EntireColumn.Hidden = True
Range("Prod_AuditorComments").EntireColumn.Hidden = strHidden
Case "8.0"
Range("Meas_Spellcheck").CheckSpelling
strHidden = Range("Meas_AuditorComments").EntireColumn.Hidden
Range("Meas_AuditorComments").EntireColumn.Hidden = False
Range("Meas_AuditorComments").CheckSpelling
Range("Meas_AuditorComments").EntireColumn.Hidden = True
Range("Meas_AuditorComments").EntireColumn.Hidden = strHidden
Case "Summary"
Range("Sum_SpellCheck").CheckSpelling
End Select
QuickProtect
Application.EnableEvents = True
MsgBox "SpellCheck Complete", vbOKOnly, "Spelling"
End Sub
</code