Assigning Existing Tools (Cut, Copy, Paste, Etc.) To Function Keys (F1-F12) - Globally?

miketurn

Active Member
Joined
Dec 8, 2016
Messages
268
Hello Everyone,

At the moment I am using Excel 2000 and I was wondering if there was a way to assign existing tools such as Cut, Copy, Paste, Etc. to the "Function" keys F1-F12 on a global level (available in all spreadsheets)

Not sure exactly what my hotkey layout will be at the moment, but lets say for this post that I want....

The following to be assigned to the existing tools CUT, COPY and PASTE (not Macros, so they can be undone)
F3 - "Copy"
F4 - "Cut"
F5 - "Paste"

In doing some research I found many examples that look like the code below.
Which I have gotten to work fine, the problem is I just don't know the value to enter for the existing tools CUT, COPY, PASTE.
I could create a single macro for each and just apply the macro this way below, but in using the existing tools I will be able to use the "undo" command and with a macro I probably wouldn't be able to do so.

Can something like this be done?

Thank You to anyone who reads this and for any advice.

Code:
Private Sub Workbook_Open()
    Application.OnKey "{F9}", "MyMacro"
End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Application.OnKey "{F9}", ""
End Sub
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
My question would be - why would you want to? excel (actually windows) already has built-in shortcut for all of what you asked for...
CTRL C = copy
CTRL V = Paste
CTRL Z = Undo

There are suites that will show you all the most common shortcuts
 
Upvote 0
Thank You for your response
I am aware of those but am looking for a single key option.

Odd that something simple like this, is not possible without a macro?

I don't mind having to record a macro for CUT and COPY but it is the PASTE function that concerns me because it won't be able to be undone if a mistake is made.
Apparently you can have a macro save before it is run and then if a mistake is made you can just reload your spreadsheet but for something like this I wouldn't really want my spreadsheet saving during every single PASTE action I perform and if a mistake is made I would have to reload spreadsheet.

There really is no code for a macro to run an existing tool such as PASTE so that after it is performed it can be undone?

If anyone else has any information to share please let me know.
Thanks Again
 
Upvote 0
Im sure that you could create a macro that will do all that with 1 keystroke. But flr this...
There really is no code for a macro to run an existing tool such as PASTE so that after it is performed it can be undone?
to the best of my knowledge no, that is not possible with VBA

The CTRL C and CTRL V etc are only 1 extra keystroke, and I use them almost automatically (pinky on CTRL, index on C or V
 
Upvote 0
Hey Ford,
Thank You for sticking with me with the matter.
I checked out the site you recommended but I didn't really find anything that would solve my problem.

I have a couple of ideas / questions (might have to break them up into separate threads if I have to)
I have been researching them quite a bit but nothing working for me yet.

1A.) Is there a way to have a macro apply a specific keystroke such as CTRL+V to paste?
1B.) If so would this be able to be undone because although it is a macro, the last action it would be applying would be CTRL+V keystroke.

In doing some research I found a site that described "SendKeys", I am not a script writer but I gave the following code a shot hoping it would work, but it did not.

Code:
Sub Paste()
SendKeys "^V"
End Sub

The ^ carat key is supposed to be the symbol for the CTRL key and V is well the letter V.


2.) I then thought I would just try to record the paste action to see if I could at least get a PASTE hotkey that would not be able to be undone, but the tool I created only worked 50%.

Code:
Sub Paste()
ActiveSheet.Paste
End Sub

If I copied text from say a separate WORD document and used this tool to PASTE it works.
If I select a cell within my EXCEL spreadsheet where it shows the cell outlined in dashed rectangle, I get

Runtime Error "1004" Paste Method of worksheet class failed

I have been out of school for a while now but I am still failing classes.


3.) Does anyone know of an already existing PASTE macro that contains code for the ablity to UNDO the PASTE action it performs? Preferably some kind of UNDO code that does not require a SAVE of the spreadsheet each time it is activated.


I know my forum requests can be a little weird but I can't be the only one that has ever desired such a tool?
I know I am using an old version of Excel but it is funny how powerful and complex Excel is with all its Functions / Equations / Scripting / Programming / Etc. yet mapping something like PASTE to a desired hotkey cannot be done easily.

I am feeling the same way about one of my other posts, that requires something simple, yet no simple way of doing it
http://www.mrexcel.com/forum/excel-questions/979939-cut-cell-data-but-dont-remove-fill-color.html

Anyways, Thanks Again For Your Help
If anyone has any other things to try, please share.
 
Upvote 0
Sorry to post again but I could not edit my above post (10 minute limit?)
I was able to get my QUESTION #2 to work so ignore that
You have to make it a button for it to work, because if you try to run it from Macros dialog box it deselects the cell with the dashed outline.
So that tool works but it cannot be undone.
So still looking for help with QUESTIONS 1 and 3
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,587
Messages
6,120,405
Members
448,958
Latest member
Hat4Life

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top