ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reprogram/reassign some function keys in Excel 2007 (https://www.excelbanter.com/excel-programming/427484-reprogram-reassign-some-function-keys-excel-2007-a.html)

Per Moeller-Olsen

Reprogram/reassign some function keys in Excel 2007
 
Hi,



We would like to reprogram/reassign Excel 2007 F4 to do something similar to
this:



"From your current selected cell go 6 columns right and make that cell
selected"



I think the code for that is roughly: ActiveCell.Offset(rowoffset:=0,
columnoffset:=6).Select



and with the function key stuff it roughly is: Application.OnKey "{F4}",
"ActiveCell.Offset(rowoffset:=0, columnoffset:=6).Select"



but the OnKey stuff does not work as far as we can tell. They are using
Excel 2007.



1) Any ideas? We have a customer that really would like to
reprogram/reassign some function keys in Excel, will help them a lot.



2) If it does not work with our approached method, can you maybe give
another method for reprogram/reassign the Excel 2007 keys?



Per...




Dave Peterson

Reprogram/reassign some function keys in Excel 2007
 
You actually have to reassign the key to a subroutine--not just the code that
you want run.

This would go into a general module:

Option Explicit
Sub auto_open()
Application.OnKey "{F4}", "SelectOver6Cols"
End Sub
Sub auto_Close()
Application.OnKey "{F4}"
End Sub
Sub SelectOver6Cols()
On Error Resume Next
ActiveCell.Offset(0, 6).Select
If Err.Number < 0 Then
Err.Clear
Beep 'to far to the right already!
End If
On Error GoTo 0
End Sub





Per Moeller-Olsen wrote:

Hi,

We would like to reprogram/reassign Excel 2007 F4 to do something similar to
this:

"From your current selected cell go 6 columns right and make that cell
selected"

I think the code for that is roughly: ActiveCell.Offset(rowoffset:=0,
columnoffset:=6).Select

and with the function key stuff it roughly is: Application.OnKey "{F4}",
"ActiveCell.Offset(rowoffset:=0, columnoffset:=6).Select"

but the OnKey stuff does not work as far as we can tell. They are using
Excel 2007.

1) Any ideas? We have a customer that really would like to
reprogram/reassign some function keys in Excel, will help them a lot.

2) If it does not work with our approached method, can you maybe give
another method for reprogram/reassign the Excel 2007 keys?

Per...


--

Dave Peterson

Per Moeller-Olsen

Reprogram/reassign some function keys in Excel 2007
 
Thx. Will give it a shot when things ease a bit around here with all the
const custmr suprt we get involved in. Per...

"Dave Peterson" wrote in message
...
You actually have to reassign the key to a subroutine--not just the code
that
you want run.

This would go into a general module:

Option Explicit
Sub auto_open()
Application.OnKey "{F4}", "SelectOver6Cols"
End Sub
Sub auto_Close()
Application.OnKey "{F4}"
End Sub
Sub SelectOver6Cols()
On Error Resume Next
ActiveCell.Offset(0, 6).Select
If Err.Number < 0 Then
Err.Clear
Beep 'to far to the right already!
End If
On Error GoTo 0
End Sub





Per Moeller-Olsen wrote:

Hi,

We would like to reprogram/reassign Excel 2007 F4 to do something similar
to
this:

"From your current selected cell go 6 columns right and make that cell
selected"

I think the code for that is roughly: ActiveCell.Offset(rowoffset:=0,
columnoffset:=6).Select

and with the function key stuff it roughly is: Application.OnKey "{F4}",
"ActiveCell.Offset(rowoffset:=0, columnoffset:=6).Select"

but the OnKey stuff does not work as far as we can tell. They are using
Excel 2007.

1) Any ideas? We have a customer that really would like to
reprogram/reassign some function keys in Excel, will help them a lot.

2) If it does not work with our approached method, can you maybe give
another method for reprogram/reassign the Excel 2007 keys?

Per...


--

Dave Peterson





All times are GMT +1. The time now is 12:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com