View Single Post
  #2  
Old June 18th, 2004, 03:26 AM
Dave Peterson
external usenet poster
 
Posts: n/a
Default Ctrl+A macro fix for problem in Excel 2003

Maybe just assigning the macro to an .onkey procedu

Option Explicit
Sub auto_open()
Application.OnKey "^a", "myCtrlA"
End Sub
Sub auto_close()
Application.OnKey "^a"
End Sub
Sub myCtrlA()
Dim myCell As Range
Set myCell = ActiveCell
ActiveSheet.Cells.Select
myCell.Activate
End Sub




David McRitchie wrote:

Ctrl+A macro fix for problem in Excel 2003
-------------------------------------------------------------

Restore normal Ctrl+A before risking your data. Ctrl+A has always
meant one thing (Select everything) in all PC applications that have
any selection or editing ability. Excel 2003 has deviated from this
standard.

The Excel developers decided that Excel 2003 would have
a double meaning for Ctrl+A there is only one other shortcut
that I know of with two meanings and that one was a toggle (Ctr+`).
Click Ctrl+A once and you get Ctrl+* (current region), click it
twice and you get what you expect (select everything: data & shapes).

The following macro uses application.RecordMacro to
generate the code that you would not otherwise see within a
recorded macro when a macro was invoked / embedded
(recording embedded macros was done prior to Excel 2000).

Naturally it is not the *best* solution because if you have macros
turned off in Excel 2003 you place your data at risk by not getting
what you expect.

Sub Ctrl_A()
'Excel 2003 Ctrl+A is FUBAR·ed in Excel 2003
' use this shortcut to cut your loses, (D.McR 2004-06-16)
' BEFORE you destroy your data integrity.
'Ctrl+A is fixed on this machine if assigned to Ctrl+A
'You must preserve the active cell or use of Ctrl+A
' for normal use such a preselecting a cell before Ctrl+A, then sort
Dim acell As Range
Set acell = ActiveCell
Cells.select
Application.RecordMacro "'Comment from Ctrl_A in " _
& ThisWorkbook.Name
Application.RecordMacro "Cells.Select ' Ctrl_A"
acell.Activate
Application.RecordMacro "Range(""" & acell.Address(0, 0) _
& """).activate ' Ctrl_A"
Beep 'if you want to indicate restored usage
End Sub

The above have been included included on an Excel 2003 topic on my
Shortcut Keys in Excel
http://www.mvps.org/dmcritchie/excel...x2k.htm#foobar

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm


--

Dave Peterson