I'm having some trouble getting the code below to work with the keyboard shortcut. However, it works when I run it from the macro menu. I modified it from a macro written for me by royUK. I had the same problem with that macro and I "fixed" it by recording a macro, specifying my chosen keyboard shortcut, and hitting the stop record button before doing anything else. Then I pasted the rest of the code from royUK's maco. It worked perfectly. I did this exact same thing with the code I modified, and I'm still having the same problem. So, clearly, I don't understand what's going on. There must be some small syntax I'm unaware of that is causing otherwise fine macros not to link to their shortcuts.
Can anyone help?
I should also ad that I am less than a novice at writing macros. Last night was the first time I ever ever played with the code at all. I have virtually no idea what I'm doing.
Sub day_4___SortByMust()
'
' day_4___SortByMust Macro
'
' Keyboard Shortcut: Ctrl+Shift+M
ActiveCell.Offset(0, -22).Range("A1:X30").Select
With ActiveSheet
.Sort.SortFields.Clear
.Sort.SortFields.Add Key:=ActiveCell.Offset(0 _
, 19).Range("A1:A30"), SortOn:=xlSortOnValues, Order:=xlDescending, _
DataOption:=xlSortNormal
.Sort.SortFields.Add Key:=ActiveCell.Offset(0 _
, 22).Range("A1:A30"), SortOn:=xlSortOnValues, Order:=xlAscending, _
DataOption:=xlSortNormal
With .Sort
.SetRange ActiveCell.Range("A1:X30")
.Header = xlGuess
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End With
End Sub
Bookmarks