Macro doesn't work with shortcut key

domtrump

Board Regular
Joined
Apr 1, 2010
Messages
245
I have a macro that copies a worksheet and pastes it into another workbook. If I run the macro using the developer tab on the ribbon, everything works fine. However, if I assign a shortcut key to it (ctrl-shift-k) then the macro starts to run but doesn't complete the copy & paste operation. Can anyone explain what is going on? Thanks.

Excel 2007:

Code:
Sub makedge()
'
' makedge Macro
' Copy Daily Worksheet to a new file for e-mail
'
    Sheets("Forecast Worksheet_Daily").Select
    Cells.Select
    Selection.Copy
    Workbooks.Open Filename:= _
        "S:\Financial Accounting\report2.xls"
    
    Cells.Select
    ActiveSheet.Paste
    ActiveWorkbook.BreakLink Name:= _
        "S:\Financial Accounting\report1.xls" _
        , Type:=xlExcelLinks
   
    Rows("94:101").Select
    Selection.EntireRow.Hidden = True
    
    Application.CutCopyMode = False
    Range("a2").Select
    ActiveWorkbook.Save
    
End Sub
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
http://www.mrexcel.com/forum/showthread.php?t=563010

check out this thread, very similar problem.

Thanks for your interest but I just figured it out. It's due to a bug in excel which is related to a conflict between using the 'open workbook' method and having the 'Shift' key pressed. In practical terms this means if your macro opens a workbook, you cannot have the Shift key as part of the keyboard shortcut to fire the macro. I simply changed the shortcut from 'Ctrl' + 'Shift' and 'J' to 'Ctrl' + 'J'.
 
Upvote 0
This was very helpful. It is always maddening to try and solve and issue, when no issue really exists (software bugs).
I did want to mention that my "Shift" shortcut works just fine. It was when I copied this large workbook and modified it, that the macro ceased to work. When I removed the "Shift" from my macro, now the modified workbook works.

Thanks for the research!
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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