Keyboard Shortcuts, Multiple Workbooks with the same shortcut Open at the same time

Tonycing

New Member
Joined
Jun 6, 2018
Messages
1
I have two workbooks, each with a Keyboard shortcut assigned to the same key stroke combination. Both of the shortcuts do similar things, e.g. delete or add rows, but because the workbooks are different in terms of number of columns and content, the Macro can't work exactly the same in either workbook.

Excel is running the keyboard shortcut for workbook A when I use it in Workbook B, instead of using the shortcut that was programmed in workbook B.

My work-around solution is to only have one of these workbooks open at a time, but does anyone know how to make the keyboard shortcuts and their macros for the active workbook precede other open workbooks?

Thank you!
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try something like this:
Code:
Sub Workbook_Name()
'Modified 6/6/18 1:55 PM EDT
If ActiveWorkbook.Name = "Book1" Then
Cells(1, 1).Value = "Book1"
End If
If ActiveWorkbook.Name = "Book2" Then
Cells(1, 1).Value = "Book2"
End If
End Sub

Put this same Macro in both Workbooks.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,902
Messages
6,175,278
Members
452,629
Latest member
SahilPolekar

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