ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Assign F1 as a macro? (https://www.excelbanter.com/excel-discussion-misc-queries/114668-assign-f1-macro.html)

Ryk

Assign F1 as a macro?
 
I have made this from a old post, but it doesn't work, the help screen
comes up...any ideas why?

Option Explicit
Sub DownRow()
Range("G" & ActiveCell.row + 1).Select
End Sub
Sub F1On()
Application.OnKey "{f1}", "DownRow"
End Sub
Sub F1Off()
Application.OnKey "{f1}"
End Sub

Its modified from a Dave Pederson answer in another post.

Ryk


Bob Phillips

Assign F1 as a macro?
 
It works for me. Did you run F1On before trying to use F1?

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ryk" wrote in message
oups.com...
I have made this from a old post, but it doesn't work, the help screen
comes up...any ideas why?

Option Explicit
Sub DownRow()
Range("G" & ActiveCell.row + 1).Select
End Sub
Sub F1On()
Application.OnKey "{f1}", "DownRow"
End Sub
Sub F1Off()
Application.OnKey "{f1}"
End Sub

Its modified from a Dave Pederson answer in another post.

Ryk




Ryk

Assign F1 as a macro?
 

How do i run F1On? I thought macro did all the work?

Ryk


Gord Dibben

Assign F1 as a macro?
 
Ryk

Works fine in my Excel 2003.

Where did you enter the code?

Does the macro DownRow work on its own?

All 3 should be placed into a General module.

F1On must be run first to set the F1 key to run DownRow macro.


Gord Dibben MS Excel MVP

On 16 Oct 2006 15:07:20 -0700, "Ryk" wrote:

I have made this from a old post, but it doesn't work, the help screen
comes up...any ideas why?

Option Explicit
Sub DownRow()
Range("G" & ActiveCell.row + 1).Select
End Sub
Sub F1On()
Application.OnKey "{f1}", "DownRow"
End Sub
Sub F1Off()
Application.OnKey "{f1}"
End Sub

Its modified from a Dave Pederson answer in another post.

Ryk



Ryk

Assign F1 as a macro?
 


Macro itself works fine, assigned it to a button.
How do i run F1On? I thought macro did all the work?

Ryk


Bob Phillips

Assign F1 as a macro?
 
It does, but it has to be run somehow.

Either run it manually (ToolsMacroMacros..., select it from the list, and
hit Run.

or put it in the Workbook Open


Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call F10Off
End Sub

Private Sub Workbook_Open()
Call F10On
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Ryk" wrote in message
s.com...

How do i run F1On? I thought macro did all the work?

Ryk




Ryk

Assign F1 as a macro?
 

I added this....in the this workbook spot... modified it to be F1 not
F10.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Call F1Off
End Sub


Private Sub Workbook_Open()
Call F1On
End Sub


Get sub or function not defined error.


Ryk

Assign F1 as a macro?
 

Ok Ok , seems I am not the brightest bulb, got confused, then it
dawned, run the F1On macro, to assign it heheh. Works awesome, thanks
guys.

Ryk



All times are GMT +1. The time now is 02:19 AM.

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