Is there a way to assign Alt+A to use as a shortcut to run the following macro?
I have this macro assigned to a customUI Ribbon, so when I click the button on the ribbon, it will copy cells A:F of whichever cell I select in column A and paste it into another workbook that is open. However, this is used quite frequently and I would like to assign Alt+A to it. I tried the Application.OnKey method, but it still wouldn't do anything. I prefer to use Alt+A due to the convenient location and proximity of those key combos. I've spent quite a while trying to figure this one out, but am finally giving up to ask for some assistance.
Here is what I used in Module3
Then I added the following in ThisWorkBook
Thank you very much in advance for any assistance!
VBA Code:
Sub COPY(control As IRibbonControl)
ActiveCell.Offset(0, 0).Range("A1:F1").Select
Application.CutCopyMode = False
Selection.COPY
Application.Run "BACK"
ActiveCell.Offset(0, 0).Range("A1:F1").Select
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Select
Windows("DATABASE.XLSM").Activate
Application.CutCopyMode = False
End Sub
I have this macro assigned to a customUI Ribbon, so when I click the button on the ribbon, it will copy cells A:F of whichever cell I select in column A and paste it into another workbook that is open. However, this is used quite frequently and I would like to assign Alt+A to it. I tried the Application.OnKey method, but it still wouldn't do anything. I prefer to use Alt+A due to the convenient location and proximity of those key combos. I've spent quite a while trying to figure this one out, but am finally giving up to ask for some assistance.
Here is what I used in Module3
VBA Code:
Sub CopyShortCut()
Application.OnKey "%{A}", "Admin.COPY" 'I also tried without using Admin.
End Sub
Then I added the following in ThisWorkBook
VBA Code:
Option Explicit
Private Sub Workbook_Open()
Call Module3.CopyShortCut
End Sub
Thank you very much in advance for any assistance!