AutoCorrect Error in (my?) Excel

L

Lee Meadowcroft

Hi all,

I have just noticed an error with the autocorrect feature that is
causing me some problems in one of my spreadsheet programs. I have a
VBA Workbook_Open routine that adds autocorrect entries for each letter
of the alphabet "a" to "A" etc. and then removes them in a BeforeClose
routine.

The problem comes when trying to autocorrect two adjacent rows. I set
up a little test in a blank workbook and found the same problem. Try
this:

Add an autocorrect entry for "a" to "A".
Type "a" in cell A1, text changes to "A"
Type "a" in cell A2, text stays as "a"

But, if you leave a row out and now type "a" in cell A4 the text
autocorrects. The error only occurs when trying to autocomplete two
adjacent rows. There is also an error once you have autocorrected say
B10 and then try to autocorrect B5.

I havent noticed this before and am wondering if it is some setting on
my home PC that is different to my work PC.

I would be grateful if someone could check if this also occurs with
their Excel so I can shed some light on the issue.

Many Thanks

Lee
 
G

Gord Dibben

Can't see your Workbook_Open code that builds the Autocorrect list, so hard to
tell what's going on.

If all you want is to convert Lower case entries to Upper case as you type, use
this event code in the worksheet module.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column > 256 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP
 
L

Lee Meadowcroft

Thanks for your suggestion, could you further develop that for me so
that only single character text in a cell will change to upper case
e.g. revision letter cell will have A,B,C etc. and another cell has
similar entries.

There is a data validation on the cell to only allow certain capital
letters, will the worksheet_change method kick in before the data
validation. e.g. one column can only accept H,A,B,C and the revision
column accepts A-Z.

Thanks,

Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top