PDA

View Full Version : Assign Shortcut To Macro To Be Available For All Active Workbooks



NITIN SHETTY
03-30-2013, 02:34 PM
Dear All,

I need a help i use certain macros several times in a day.Actually i want to create a short-cut for those macros.

For Eg: i use this below mentioned macro function to console all the sheets of a worksheet.


Sub Combine()
'
' Developed by PCS_Help
' For immediate help goto PCS_Help - CrossLoop Expert in Most problems. Windows XP, Server, Vista, Office, Word, Excel, Access, Outlook, Powerpoint, Publisher, VBA, Quickbooks, ... (http://www.crossloop.com/PCS_Help)
'
Dim NumSheets As Integer
Dim NumRows As Integer

' Change the value of NumSheets to equal the number of sheets you wish to combine
NumSheets = 173

' Change the value of NumRows to equal the number of rows in each sheet
NumRows = 43

Worksheets(1).Select
Sheets.Add
ActiveSheet.Name = "Consolidated"
For X = 1 To NumSheets
Worksheets(X + 1).Select
Rows("1:" & NumRows).Select
Selection.Copy
Worksheets("Consolidated").Select
ActiveSheet.Paste
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
Worksheets(X + 1).Select
Range("A1").Select
Next X
Worksheets("Consolidated").Select
Range("A1").Select
End Sub

What i do is open the excel file press alt+f11 then i click on insert then module then i paste the above formula and run it this consolidates each sheet of my file.
I do this daily and on different files what i want is create a short cut for this formula short-cut for eg ctrl+shift+O to run this macro.
Can you please help with the procedure as there are few more formulas for which i have to assign short cut.
Please help.

Thanks & Regards

Nitin Shetty.

Excel Fox
03-30-2013, 11:48 PM
Nitin, please use code tags, to wrap your code. It makes more legibility.

Now, why don't you save your code in the Personal file, and manually assign a hot key. That way, it will always remain the way you've assigned, without having to do it again and again.