ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How to remove Keyboard Shortcut CTRL+D (https://www.excelbanter.com/excel-discussion-misc-queries/70795-how-remove-keyboard-shortcut-ctrl-d.html)

csilly1979

How to remove Keyboard Shortcut CTRL+D
 
Hi,
I would like to remove the Ctrl+D shortcut from the Excel cause it causes me
a lot of trouble. It's a built in shortcut. Can I remove it in any way? Tks.

Ken Johnson

How to remove Keyboard Shortcut CTRL+D
 
Hi csilly,
I'm guessing you want to remove the Ctrl + d shortcut for duplicating a
shape object.
If you paste the following code into the ThisWorkbook code module that
keyboard shortcut will be automatically disabled when that workbook is
opened...

Private Sub Workbook_Open()
Application.OnKey "^d", ""
End Sub

To get the code in place:

1. Copy
2. Right-click any of the worksheet tabs. A contextual popup menu
appears.
3. Select "View code" from the popup menu to get to the VBA editor
4. Go ViewProject Explorer to ensure that the Project Explorer is
visible.
5. Double click the ThisWorkbook icon (has the green X) to open the
ThisWorkbook code module.
6. Paste the code into place.
7. Press Alt + F11 or go FileClose and return to Microsoft Excel to
return to the workbook.

To see that the code has the desirable effect, close the workbook then
reopen.
Security level should be set to medium for the macro to work.


Ken Johnson


csilly1979

How to remove Keyboard Shortcut CTRL+D
 
well, I work alot in Excel with importand data, and I have to save my work
quite often. And I hit by mistake Ctrl+D instead of Ctrl+S and this of course
alters my work... I really need to get rid of what Ctrl+D does (fills the
active cell with the value of the upper cell).
Tks again.

"Ken Johnson" wrote:

Hi csilly,
I'm guessing you want to remove the Ctrl + d shortcut for duplicating a
shape object.
If you paste the following code into the ThisWorkbook code module that
keyboard shortcut will be automatically disabled when that workbook is
opened...

Private Sub Workbook_Open()
Application.OnKey "^d", ""
End Sub

To get the code in place:

1. Copy
2. Right-click any of the worksheet tabs. A contextual popup menu
appears.
3. Select "View code" from the popup menu to get to the VBA editor
4. Go ViewProject Explorer to ensure that the Project Explorer is
visible.
5. Double click the ThisWorkbook icon (has the green X) to open the
ThisWorkbook code module.
6. Paste the code into place.
7. Press Alt + F11 or go FileClose and return to Microsoft Excel to
return to the workbook.

To see that the code has the desirable effect, close the workbook then
reopen.
Security level should be set to medium for the macro to work.


Ken Johnson



Ken Johnson

How to remove Keyboard Shortcut CTRL+D
 
Hi,
You're welcome.
I've never used Ctrl+d to do that. I learn something new every day.
Thanks for that.
Ken Johnson



All times are GMT +1. The time now is 08:43 AM.

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